RE: [PHP] PHP Auto-Date Select Box

2003-04-04 Thread Matt Schroebel
 -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



Re: [PHP] PHP Auto-Date Select Box

2003-04-04 Thread Marek Kilimajer
for($i = 0; $i = 7; $i++) {
   $day=strtotime(+$i day);
   echo 'option value='. date('Y-m-d',$day) .''. date(' *your 
format here* ',$day).'/option';
}

Jay Fitzgerald wrote:

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


Jay Fitzgerald, Design Director
Bayou Internet - http://www.bayou.com
Toll Free: 888.30.BAYOU (22968)
Vox: 318.338.2034 / Fax: 318.338.2506
E-Mail: [EMAIL PROTECTED]
ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf




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