I have a in which my DOB is registered depending on the selection in a drop down list.
Date of Birth:
<select name="DOBDay" required>
<option> Day </option>
<option value="1">1</option>
<option value="2">2</option>
// etc ....
The same approach is adopted for month and year. As a result of this, when I process the registration form, data is obtained from these three dropdowns and are assigned to three different variables:
$DOBDay = strip_tags(@$_POST['DOBDay']);
$DOBMonth = strip_tags(@$_POST['DOBMonth']);
$DOBYear = strip_tags(@$_POST['DOBYear']);
I need a way I can get the current age of the user based on the DOB provided, but since I have it stored in three different variables (and three different columns in my database), I don't know how I can get their current age. Any ideas?
More details:
I need an $age
variable which will calculate the age and I need it to be of type int, so that I can store the age in the age
column in my db.