You are here: Re: Populating "Month" Dropdown Menu « All PHP « IT news, forums, messages
Re: Populating "Month" Dropdown Menu

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация