Use form Validation in Codeigniter
Paste in Codeigniter
if($this->input->post('login')){
$email=$this->input->post('login_email');
$password=$this->input->post('login_password');
$this->load->library('form_validation');
$this->form_validation->set_rules('login_email', 'Email', 'required|valid_email');
$this->form_validation->set_rules('login_password', 'Password', 'required|min_length[10]');
if ($this->form_validation->run() == FALSE) {
//redirect('dashboard');
//echo 'not-working';
}
else {
$query = $this->Customer_model->login_detail($email,$password);
if(count($query)>0){
//session_start();
$this->session->set_userdata('ID',$query[0]['ID']);
redirect('dashboard', 'refresh');
}
else{
redirect('register');
}
}
}
Comments
Post a Comment