Re: list of Months
| From: | afan at afan dot net | Date: | Fri, 01 Oct 2004 13:19:24 +0000 |
| Subject: | Re: list of Months | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-198408@lists.php.net to get a copy of this message | ||
Well, looks like the idea is alway the same, with some (very usefull)
variations.
Thanks for help!
Afan
> afan@afan.net wrote:
>> Hi,
>> to create a list of all months in drop-down menu I use this code:
>>
>> <?php
>> $month_names = array(1=>'Jan', 'Feb', 'Mar',
>> 'Apr', 'May', 'Jun', 'Jul',
>> 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
>> ?>
>>
>> <select name="QuoteMonth">
>> <option value=""></option>
>> <?php
>> for($i=1; $i<=12; $i++)
>> {
>> if(date('m') == $i) $selected_QuoteMonth = 'SELECTED';
>> else $selected_QuoteMonth = '';
>> echo "<option value=$i $selected_QuoteMonth> $i </option>";
>> }
>> ?>
>> </select>
>
> What about dumping the $month_names array and using strftime()?
>