0
如何創建一個選項,並選擇今天提前2天選擇作爲PHP中的默認選項(即48小時窗口)?這是我目前使用的代碼,但不幸的是它不工作!選擇當前日期的菜單
<?php
$weekday = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
$days = range (1, 31);
$currentDay = date('F');
echo "<select name='weekday'>";
foreach ($days as $value) {
$default = ($value == $currentDay)?'selected="selected"':'';
echo '<option '.$default.' value="'.$value.'">'.$value."</option>\n";
}
echo '</select> ';
?>