codeigniter - CI Form validaion returns false but validaion_errors() is blank -


my code :

public function add()     {         if ($this->input->post())         {             //echo '<pre>';print_r($this->input->post());exit;             $this->form_validation->set_rules('agency[title]','title','required');             $this->form_validation->set_rules('agency[first_name]','first name','trim|required|min_length[3]');             $this->form_validation->set_rules('agency[last_name]','last name','trim|required|min_length[3]');             $this->form_validation->set_rules('agency[email]','email','trim|required|valid_email|is_unique[agency.email]');             $this->form_validation->set_rules('password','password','trim|required|min_length[3]');             $this->form_validation->set_rules('conf_password','confirm password','required|matches[password]');             $this->form_validation->set_rules('agency[agency_unique_id]','agency unique id','trim|required|min_length[3]|is_unique[agency.agency_unique_id]');             $this->form_validation->set_rules('agency[vat_registered]','vat registered','trim|min_length[3]');             $this->form_validation->set_rules('agency_profile[address1]','address 1','trim|required|min_length[3]');             $this->form_validation->set_rules('agency_profile[address2]','address 2','trim');             $this->form_validation->set_rules('agency_profile[address3]','address 2','trim');             $this->form_validation->set_rules('agency_profile[town]','town','trim|required|min_length[3]');             $this->form_validation->set_rules('agency_profile[postcode]','post code','trim|required');             $this->form_validation->set_rules('agency_profile[phone]','phone','trim|required|integer|exact_length[11]');             $this->form_validation->set_message('is_unique','%s present. plesae provide diffrent value');             if($this->form_validation->run() != false)             {                 //i never reach part..             }             else             {                 echo validation_errors();exit;                                 // no errors printed on screen.             }          }          $data['middle'] = 'agency/add';         $this->load->view('template/template',$data);     } 

you need echo below statement in top of view page not controller page

 <?php echo validation_errors(); ?> 

controller page:

 if($this->form_validation->run() != false)         {             //i never reach part..         }         else         {             //here load view page...         } 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -