ik zoek eigenlijk een scriptje wat een drop-down-menu maakt met daarin de data van de afgelopen 4 weken (beginnend bij de huidige dag). Iemand die zoiets heeft liggen? Of misschien weet hoe zoiets in elkaar gezet kan worden?
Ik bedoel zoiets, alleen dan moet hij terugtellen, deze neemt 30 dagen vanaf vandaag.
<?php
function DateDropDown($size=30,$default="DropDate") {
// $size = the number of days to display in the drop down
// $default = Todays date in m:d:Y format (SEE DATE COMMAND ON WWW.PHP.NET)
// $skip = if set then the program will skip Sundays and Saturdays
$skip=0;
echo "<select name=$default STYLE=\"font-family: monospace;\">\n";
for ($i = 0; $i <= $size; $i++) {
$theday = mktime (0,0,0,date("m") ,date("d")+$i ,date("Y"));
$option=date("D M j, Y",$theday);
$value=date("m:d:Y",$theday);
$dow=date("D",$theday);
if ($dow=="Sun") {
echo "<option disabled> </option>\n";
}
if ($value == $default) {
$selected="SELECTED";
} else {
$selected="";
}
if (($dow!="Sun" and $dow!="Sat") or !$skip) {
echo "<option value=\"$value\" $selected>$option</option>\n";
}
}
echo "</select>\n";
}
//If the date is there because the SUBMIT button was pushed then print it
//You probably should use $_POST['dropdate'] in the if statment below but.....
if ($dropdate != "") {
echo "The date returned from the control is: " . $dropdate;
}