Codeigniter: check date of birth as a callback

Hello
Am trying to restrict users who are less than 18 years from registering so am using a codeigniter 3 callback function to validate the age of the user here is my code:

$this->form_validation->set_rules('dob', 'Date of birth', 'trim|required|max_length[13]|callback_check_captcha');

$dateofbirth = $this->input->post('dob');
$birth = (date('Y') - 17).'/'.date('01/01');
if(strtotime($dateofbirth) >=  strtotime($birth)){
  $this->form_validation->set_message('check_captcha','Sorry you need to be 18 years or older');
}

but it produce this error: 
*Unable to access an error message corresponding to your field name Date of birth.(check_captcha)*

Please help.
Thanks in advance.

Sponsor our Newsletter | Privacy Policy | Terms of Service