PHP generation of <select> fields
| From: | Dash McElroy | Date: | Wed, 01 May 2002 03:55:42 +0000 |
| Subject: | PHP generation of <select> fields | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-13446@lists.php.net to get a copy of this message | ||
I am trying to use PHP to generate and automatically select the current
month in an HTML Form. Here is the code that flails:
for ($i=01;$i<=12;$i++) {
if($i = date(m)) {
$selected = " selected";
}
print "<option
value=\"".date(m,mktime(0,0,0,$i))."\"$selected>".date(F,mktime(0,0,0,$i))."
</option>\n";
}
The output is a large amount of April's in the Select dropdown box - my
machine then goes crazy for a while whilst the hard drive chunks like mad.
Thanks.
-Dash