For email validation in Codeigniter Form Module
You may use valid_email () function of $this->load->helper('email') library
PHP Script:
$this->form_validation->set_rules('email', 'Email', 'required|callback_valid_mail');
public function valid_mail()
{
$email = $this->input->post('email');
$this->load->helper('email');
if (valid_email($email)) {
return TRUE;
}else{
$this->form_validation->set_message('valid_mail', 'Email ID is Invalid!!');
return FALSE;
}
}
No comments:
Post a Comment