|
Posted by Janwillem Borleffs on 01/22/06 17:03
cover wrote:
> I can get the current month to display in a text box by inserting
> value="<? print strftime("%B"); ?>"> into the code for that
> particular text box on a form but how can I populate a drop down with
> names of all the months with the current one being 'default' as it
> would be in the text box example? TIA
>
$current_month = strftime("%B");
print "<select>\n";
for ($i = 1; $i < 13 && $m = strftime('%B', mktime(0,0,0,$i)); $i++) {
if ($m == $current_month) {
print "<option selected='selected'>$m</option>\n";
} else {
print "<option>$m</option>\n";
}
}
print "</select>";
JW
Navigation:
[Reply to this message]
|