> -----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-05">Friday, April 5 > <OPTION VALUE="2003-04-06">Saturday, April 6 > <OPTION VALUE="2003-04-07">Sunday, April 7 > <OPTION VALUE="2003-04-08">Monday, April 8 > <OPTION VALUE="2003-04-09">Tuesday, April 9 > <OPTION VALUE="2003-04-10">Wednesday, April 10 > <OPTION VALUE="2003-04-11">Thursday, April 11 > <OPTION VALUE="2003-04-12">Friday, April 12 > <OPTION VALUE="2003-04-05">Saturday, April 13 > <OPTION VALUE="2003-04-05">Sunday, 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