|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-07-30 04:44 UTC] rasmus@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 03:00:01 2025 UTC |
I wanted to list all the months, days and years. The script that I used written below. $year = date("Y"); $month = date("m"); $mday = date("d"); get_date($month,$mday,$year,"airway_month","airway_day","airway_year"); function get_date($month,$day,$year,$moname,$dayname,$yearname) { //get the month print "<select name=\"$moname\">\n<option value=\"0\">Month</option>"; for ($m=1;$m<=12;$m++) { if ($m <10) $nm = "0".$m; else $nm=$m; print "<option value=\"".$nm."\">".date("F",mktime(0,0,0,$m,$day,$year))."</option>\n"; } print "</select>\n/\n"; // get the day print "<select name=\"$dayname\">\n<option value=\"0\">Date</option>\n"; $limit = 31; for ($d=1;$d<=$limit;$d++) { if ($d < 10) $nd= "0".$d; else $nd = $d; print "<option value=\"".$nd."\">".$nd."</option>\n"; } print "</select>\n/\n"; // get the year $yr_strt = $year - 1; $yr_end = $year + 5; print "<select name=\"$yearname\">\n<option value=\"0\">Year</option>\n"; for ($y=$yr_strt;$y<=$yr_end;$y++) { echo "<option value=\"".$y."\">".$y."</option>\n"; } print "</select>\n"; } When I view my HTML source, the month of February is not displayed. Instead there would be two instances of March. I would appreciate if you would inform me if there is something wrong with the script or function. Thank you.