Connecting Tech Pros Worldwide Help | Site Map

How to generate month options in a menu?

  #1  
Old March 6th, 2006, 10:05 PM
laredotornado@zipmail.com
Guest
 
Posts: n/a
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

  #2  
Old March 7th, 2006, 01:25 AM
d
Guest
 
Posts: n/a

re: How to generate month options in a menu?


<laredotornado@zipmail.com> wrote in message
news:1141682231.693678.205120@u72g2000cwu.googlegr oups.com...[color=blue]
> 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[/color]

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


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
MSDE is a COMPLETE MARKETING FAILURE as ZERO PEOPLE USE IT for anything, even development. nospam answers 75 November 22nd, 2005 03:41 AM
executing a report takes a very long time Rahul Chatterjee answers 0 November 20th, 2005 06:44 PM
MSDE is a COMPLETE MARKETING FAILURE as ZERO PEOPLE USE IT for anything, even development. nospam answers 75 July 21st, 2005 09:35 AM
Form Submission: Final URL that has form options included ?? Jared answers 5 July 20th, 2005 09:58 AM