Hi,
I've been using this code for a dropdown menu for selcection of the month from 01-12:
The sprintf is uesd to format the menu to put 0 before single numbers. The problem is is that when it comes to storing it in the MySQL database it does not include the 0. Why may this be?
// code for dropdown menu
$dob_months_list = "";
for ($i = 1; $i < 13; $i++)
{
$print_selected = "";
if ($i==$dob_month) {$print_selected = " SELECTED";}
$dob_months_list .= sprintf('<OPTION VALUE="%d" %s>%02d</OPTION>',$i, $print_selected, $i)."\n";
}
I have similar code for birthday and year
// code to create full date of birth to add to database
$dob= "$dob_year$dob_month$dob_day";
Can anyone help me?
The data is input into a table column with varchar(8) as the type.