Reply to Re: auto select actual month in dropdown box

Your name:

Reply:


Posted by Michael Fesser on 07/19/07 23:21

..oO(YvesDM)

>I already resolved this.
>My solution is not 100% clean, but it does what I want :-)
>I just an extra option on top of the list which has the selected tag
>and always takes the value of the current month ;-)

Ugly. Why not just let PHP print out all the options in a simple loop?
You could even let it generate the month names automatically if you want
(assuming proper locale support).

> <option value='$monthnow'selected>Current month</option>

There has to be a space between attributes. Additionally it's better
style to not use minimized attributes, but to write them according to
the stricter XHTML rules. This makes it easier to upgrade in the future.
So the result should look like

<option value='7' selected='selected'>Juli</option>

Micha

[Back to original 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

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