RE: [PHP-DB] One more date question (NOOOOOOO) :-)
| From: | John W. Holmes | Date: | Thu, 27 Feb 2003 17:12:13 +0000 |
| Subject: | RE: [PHP-DB] One more date question (NOOOOOOO) :-) | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-25961@lists.php.net to get a copy of this message | ||
> 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/