Hi,
I need to create a dropdown box on a webpage to display all the Sundays and all the days which are stored in the array $bank_holidays for any dates which fall between tomorroe to tomorrow + 45. Here is my code:
<?
$bank_holidays[0] = '25-Dec-2001';
$bank_holidays[1] = '26-Dec-2001';
$bank_holidays[2] = '1-Jan-2002';
$time = time() + 86400; // tomorrow
$date_dropdown = "<select name='delivery_date'><option Please select>Please select</option>";
for ($x = 1; $x <= 45; $x++){
$delivery_day_test = date(w, $time); // get day of week
for ($j = 0; $j < sizeof($bank_holidays); $j++){
$flag = 0;
if ((date("w", $time) == 0) ||($bank_holidays[$j] == date("j-M-Y", $time))){
$flag = 1;
} else {
$flag = 0;
}
}
if ($flag == 1){
$date = date("D jS F Y", $time);
$date_dropdown .= "<option $date>$date</option>";
}
$time += 86400;
}
$date_dropdown .= "</select>";
?>
However, it only returns all the Sundays and the LAST item in the array (1st Jan 2001). Why does it not show all the Sundays and all the items in the array please?
best, Graham