Re: list of Months
| From: | Marek Kilimajer | Date: | Fri, 01 Oct 2004 08:30:19 +0000 |
| Subject: | Re: list of Months | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-198385@lists.php.net to get a copy of this message | ||
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()?