RE: One more date question (NOOOOOOO) :-)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Sorry about all these emails :-)  I have one final question (For this
week
> - LOL).  How can I get the current month + the next 11 months in a
> dropdown form box?  Ideally there'd be 3 boxes, 1 with the day,
dependant
> on the month you select plus the year, though I can hardcode the year
> without a problem.
> 
> Any ideas how I could do this?

You can use mktime() and all that, or use a method like this:

$months = array(
	1 => 'January',
	2 => 'February',
	...
	13 => 'January',
	14 => 'February',
	...
	24 => 'December');

Then, where $month is the current month, 1 - 12:

$end = $month + 11;
for($x=$month;$x<$end;$x++);
{ echo $months[$x]; }

> Thanks for everything, you are all life savers.  Oh and after thinking
> about it I realized how dumb storing Credit Card details in a DB were
:-)

You're users will thank you. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux