[eluser]hkboateng[/eluser]
Hello everyone, I am writing validation for my form and it seems not for work. I have done it before but I not know why is not working with these form.
Code:
public function signup_validation()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username','required|max_length[15]|min_length[6]|xssclean|callback_validate_credentials');
$this->form_validation->set_rules('password', 'Password','required|min_length[6]');
$this->form_validation->set_rules('firstname', 'First Name','required|alpha|trim');
$this->form_validation->set_rules('lastname', 'Last Name','required|alpha|trim');
$this->form_validation->set_rules('username', 'Username','required|max_length[15]|min_length[6]|xss_clean|trim');
$this->form_validation->set_rules('password', 'Password','required|min_length[6]|alpha_dash|trim');
$this->form_validation->set_rules('confirmpwd', 'Confirm Password','required|matches[password]|trim');
$this->form_validation->set_rules('email', 'Email Address','required|valid_email|is_unique[users.email]|trm');
$this->form_validation->set_rules('city', 'City','required|alpha|trm');
$this->form_validation->set_rules('state', 'State','required|alpha|trm');
$this->form_validation->set_rules('country', 'Country','required|alpha|trim');
$this->form_validation->set_message('is_unique', "Email Address already exits");
//Loading Security helper
if ($this->form_validation->run())
{
echo "An activation code has been sent to your email.";
}
else
{
redirect('blog/signup');
}
}
Can someone let me know what am doing wrong. Thanks