PHP Code Check date of birth.?

Mark

New member
Hiya, I want to use a form where the user enters their date of birth in the format dd/mm/yyyy then use PHP to check if the user is over 18 or not and display an appropriate message.

I have the following code just not sure how to link it with the form.

$u_dob = strtotime('FORM DATE OF BIRTH HERE');
$age_req = strtotime('+18 years', $u_dob);

if(time() > $age_req) {

echo ("Confirmed Over 18");
}
else {

echo ("You are required to be at least 18 years old");

}

Also I want this in the UK format i.e dd/mm/yyyy not mm/dd/yyyy
 
Back
Top