How do I create a drop down list that automatically generates a list of
months for the next 12 months upto and including this month
eg
list labellist value
February 200202
March 2002 03
||
||
January 2003
How do I create a drop down list that automatically
generates a list of months for the next 12 months upto and including
this month
This would do it...
select name=st_month style=width: 80px class=forms
?PHP
$curr_month = date(n, mktime());
for ($x = 1; $x = 12; $x++)
{
$month_name
Another solution:
$month_now = date(n);
echo select name=\month\\n;
for($i=$month_now, $j=0; $i=($month_now+12); $i++,$j++)
{
echo option value=\$i\;
if($i == $month_now)
{
echo selected;
}
echo . date(F Y, mktime(0, 0, 0, $month_now+$j, 1, date(Y))) .
/option\n;
}
echo
3 matches
Mail list logo