Hey all-
I'd like to make a drop-down box with the values of the next 30 (or so) days, no matter the day or the month. For example, today is April 17, and I would like it to have the values April 18 to May 20 (or whatever it may be).
Getting the dates is the problem. After that I can throw them into a drop-down box no prob. I'm think mktime() would be help here, but I'm unsure of how to implement it in this case.
Thanks!
Dates in a select box.. mktime() ?
Moderator: General Moderators
Perhaps something like... (Untested, should work after some tweaking).
Code: Select all
<?php
$arr = getdate(time());
echo '<select name="date">';
echo '<option>'.date("M-d-Y", mktime(0, 0, 0, $arr['mon'], $arr['mday'], $arr['year'])).'</option>';
for($i=0;$i<=30;$i++) {
echo '<option>'.date("M-d-Y", mktime(0, 0, 0, $arr['mon'], $arr['mday']+$i, $arr['year'])).'</option>';
}
echo '</select>';
?>