Posted by Richard Conway on 01/19/06 16:50
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
You want the following:
<select name="month">
<option <?php if (date("m")=="01") echo "selected" ?>value="01">Jan</option>
<option <?php if (date("m")=="02") echo "selected" ?>value="02">Feb</option>
... and so on...
</select>
Other tidier ways to do it using for loops too if you think about it.
[Back to original message]
|