What you have is basically what I do, but the current month check could be tidied up and display the month name seeing as you have the array:
$selected_QuoteMonth = (date('m')==$i)?'SELECTED':''; echo "<option value=$i $selected_QuoteMonth> $month_names[$i] </option>"; ** CODE IS UNTESTED ** I'm sure if there is a better way then someone here will let u know. HTH Graham -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 30 September 2004 21:17 To: [EMAIL PROTECTED] Subject: [PHP] list of Months 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> Is there any better way? Thanks for any help. Afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php