Date Problem - Last Day Of Month
| From: | Vinesh Hansjee | Date: | Mon, 31 Mar 2003 13:55:46 +0000 |
| Subject: | Date Problem - Last Day Of Month | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-141707@lists.php.net to get a copy of this message | ||
Hi there, can anyone tell me how to fix my code so that on the last day of
the month, my code doesn't repeat the months...
What the code suppose to do is, makes a drop down box from which you can
select the month, and if its the current month
the box is already selected.
<select name="month">
<?
for ($i=1; $i<=12; $i++) {
if ($i == date("m")) {
print "<option selected value=\"". $i . "\">" .
date("F",mktime(0,0,0,$i,date("d"),date("Y"))) .
"</option>";
} else {
print "<option value=\"". $i . "\">" .
date("F",mktime(0,0,0,$i,date("d"),date("Y"))) .
"</option>";
}
}
?>
</select>
Thanks
Vinesh