Version: 0.1
Type: Sample Code (HOWTO)
Category: Calendars/Dates
License: GNU General Public License
Description: Displays a pull down menu with the numbers available to select instead of a textbox with yyyy-mm-dd.
This just rips apart the $date list ($year, $month, $day) = explode ('-', $date); Lists 1-31 for the amount of days. print "<select name="day">"; $i = 1; while ($i < 32) : print "<option value=""; if ($i < 10) {print "0";} print "$i" "; if ($day == $i) {print " selected";} print ">$i</option>n"; $i++; endwhile; print "</select> Lists 1-12... i.e. Jan=1,Dec=12 etc. <select name="month">"; $i = 1; while ($i < 13) : print "<option value=""; if ($i < 10) {print "0";} print "$i" "; if ($month == $i) {print " selected";} print ">$i</option>n"; $i++; endwhile; print "</select> This is for the year, 2002 is the maximum seeing as we havn't passed that year yet, if you want to increase it, just change the 2002 to a year of your choice, however it doesnt work below 1970 for some reason. <select name="year">"; $i = 1970; while ($i < 2002) : print "<option value="$i" "; if ($year == $i) {print " selected";} print ">$i</option>n"; $i++; endwhile; print "</select>"; ?>