Jon,

Try this ...  I know the code could be trimmed down, but I wrote it this way
for ease of reading.

<select name="Date">
<?

$startday = "01";
$startmonth = "01";
$staryear = "01";

$endday = "01";
$endmonth = "07";
$endyear = "01";

$startperiod = mktime(0,0,0,$startmonth,$startday,$startyear);
$endperiod = mktime(0,0,0,$endmonth,$endday,$endyear);

while($startperiod <= $endperiod) {

 $date = getdate($startperiod);
 $year = $date['year'];
 $month =  $date['mon'];
 $day =  $date['mday'];

 echo "<option value=\"$year-$month-$day\">";
 echo "$month/$day/$year";
 echo "</option>\n";

 $startperiod = $startperiod + 86400;

}
?>
</select>

Basically just uses mktime() and getdate()

The 86400 is the number of seconds in the day, and the option value is set
to return in the format YYYY-MM-DD (that format's used a lot in MySQL
tables).

Have fun ;)

James.

> 01/01/01-01/07/01
> 01/08/01-01/14/01
> 01/15/01-01/21/01
> etc
> etc
> till the end of 2002 and further in the future eventually
>
> I'd like to make PHP generate this for me so I don't have to handcode it
for
> each year in the future.  I've looked at the date/time functions and I'm a
> bit confused.  Any help would be appreciated.  Thanks!
>
> Jon
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to