-Original Message-
From: Jay Fitzgerald [mailto:[EMAIL PROTECTED]
Sent: Friday, April 04, 2003 9:17 AM
Subject: [PHP] PHP Auto-Date Select Box
Does anyone know how I can make a PHP form select box that
has the dates in
it for the next 7 days including today and the remaining days
from this week?
eg:
SELECT NAME=date
OPTION VALUE=2003-04-05Friday, April 5
OPTION VALUE=2003-04-06Saturday, April 6
OPTION VALUE=2003-04-07Sunday, April 7
OPTION VALUE=2003-04-08Monday, April 8
OPTION VALUE=2003-04-09Tuesday, April 9
OPTION VALUE=2003-04-10Wednesday, April 10
OPTION VALUE=2003-04-11Thursday, April 11
OPTION VALUE=2003-04-12Friday, April 12
OPTION VALUE=2003-04-05Saturday, April 13
OPTION VALUE=2003-04-05Sunday, April 14
/SELECT
I'd use date() and time() and a function such as
Function buildSelect($howMany,$name) {
$str = SELECT NAME=\$name\\n;
$t = time();
For (i=0;$i$howMany;$i++) {
$str .= 'OPTION VALUE=';
$str .= date('your numeric format string',$t);
$str .= ''
$str .= date('your verbose format string',$t) . \n;;
$t += 86400;
}
$str .= /SELECT\n;
return $str;
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php