php - Error Validation not showing in Codeigniter -


i have code snippet adding patient in system doesn't show error messages. have validation_errors() in views still not showing here's code

// add new item public function add() {     //some form validation rules here     $this->form_validation->set_error_delimiters('<div class="alert alert-error"><i class="icon-exclamation-sign"></i>', '</div>');     $this->form_validation->set_rules('patient_type_id','patient type id','required|trim|xss_clean|integer');     $this->form_validation->set_rules('first_name','first name','required|trim|xss_clean|max_length[50]');     $this->form_validation->set_rules('middle_name','middle name','required|trim|xss_clean|max_length[50]');     $this->form_validation->set_rules('last_name','last name','required|trim|xss_clean|max_length[50]');     $this->form_validation->set_rules('gender','gender','required|trim|xss_clean');     $this->form_validation->set_rules('age','age','required|trim|xss_clean|max_length[3]|integer');     $this->form_validation->set_rules('address','address','required|trim|xss_clean');     $this->form_validation->set_rules('status','status','required|trim|xss_clean');     $this->form_validation->set_rules('contact_number','contact number','required|integer|trim|xss_clean');     $this->form_validation->set_rules('email','email','trim|xss_clean|email|required');      //check if rules pass     if($this->form_validation->run()){       //if pass save database         $results = $this->model_nurse_patient->add();         if($results == true){             console::log('data saved database');             $message= "<i class='icon-exclamation-sign'></i>you have added new patient<br>";             $this->session->set_flashdata('success', $message);             redirect(base_url('nurse/patient'));         }else{             console::log('data not saved');             $message= "<i class='icon-exclamation-sign'></i>failed add new patient";             $this->session->set_flashdata('error', $message);             redirect(base_url('nurse/patient'));         }      }else{         //show form again errors         console::log('validation not passed');         $this->create();     }   } 

this code $this->create(). gets header ,footer , view

public function create(){     //just showing add patient  form     console::log($this->model_nurse_patient->get_all_patient_type());     $create_data['list_rel_status'] = $this->model_nurse_patient->get_all_relationship_status();     $create_data['list_patient_type'] = $this->model_nurse_patient->get_all_patient_type();     $this->nurse_patient_header(array('title'=> 'ehr v1'));     $this->load->view('users/nurse/patient/create',$create_data);     $this->nurse_patient_footer(); } 


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -