Reply to Re: How to generate month options in a menu?

Your name:

Reply:


Posted by d on 03/07/06 03:09

<laredotornado@zipmail.com> wrote in message
news:1141682231.693678.205120@u72g2000cwu.googlegroups.com...
> Hi,
>
> I'm trying to generate options in a menu that read
>
> <option value="2006-03-01 00:00:00.0">March, 2006</option>
> <option value="2006-04-01 00:00:00.0">April, 2006</option>
> ...
> <option value="2006-12-01 00:00:00.0">Decmeber, 2007</option>
>
> where the beginning is defined by the month/year of today's date and
> the end is defined by a constant "FINAL_YEAR".
>
> How would I generate the above menu using PHP 4?
>
> Thanks, - Dave

Try this:

for ($c=0; $c<12; $c++) {
$s=mktime(0, 0, 0, date("n")+$c, 1, date("y"));
echo '<option value="'.date("Y-m-d", $s).' 00:00:00.0">'.date("F, Y",
$s)."</option><br>";
}

hope it helps!

dave

[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

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