I have this function for login checker, when $email and $password wrong I want add redirect to another page, like login on a facebook page, when $email and $password incorect they direct to different page but still login page(but not the same page) and sent the message it was incorect $email or $password to the page
function basisdata_cek($password){
$email = $this->input->post('email');
$result = $this->login->login($email,$password);
if($result){
$sess_array = array();
foreach($result as $row){
$sess_array = $arrayName = array('kode_daftar'=>$row->kode_daftar, 'email'=>$row->email, 'password'=>$row->password);
$this->session->set_userdata('logged_in',$sess_array);
}
return true;
}else{
$this->form_validation->set_message('basisdata_cek','invalid email or password');
return false;
}
}
But the problem is when I add redirect page like this
}else{
redirect(base_url('index.php/login'),'refresh');
$this->form_validation->set_message('basisdata_cek','invalid email or password');
return false;
}
It's still direct page when it's incorrect email & password but the message of form_validation won't show up.