Two observations:
Build your options list from arrays like this: (rm the comments when you understand it)
PHP Code:
$days = range(1,31); // create and array
foreach($days as $day){ // loop through it and build your options
echo "<option value=$day>$day</option>" .PHP_EOL ; // add a line end so your source code is pretty
}
// months, create an array, assign the key 1 to the first instead of the default 0 value
// which array normally assigns - after they they increment automatically
$months = array(1=>'Jan', 'Feb', 'Mar', ); // etc
foreach($months as $key=> $month){
echo "<option value=$key>$month</option>" .PHP_EOL ;
}
When these vals get passed back to your script handler, you will not have "xxxx-01-02" (for 2nd Jan) but "xxxx-1-2" - but its ok because Mysql will take these as valid values - there is some leeway - so there is no need to pad out the dates/months with zeros.
You can also create write once and forget values for years with range too:
PHP Code:
$this_year = date("Y"); // you can go n years back if you want to
$span = $this_year + 4; // adds 4 more years
$years = range($this_year, $span);
foreach($years as $year){
echo "<option value=$year>$year</option>" .PHP_EOL ;
}
Bookmarks