<?php
$month=array("January"=>"01","February"=>"02","March"=>"03","April"=>"04","May"=>"05","June"=>"06","July"=>"07","August"=>"08","September"=>"09",
"October"=>"10","November"=>"11","December"=>"12");
echo"<select name='month'>";
echo"<option>-select-</option>";
foreach($month as $key=>$value)
{
echo "<option value='".$value."'>".$key."</option>"."<br />";
}
echo"</select>";
$input_month=$month;
$mkt = mktime(0,0,0,$input_month,1,date("Y")) ;
$date2 = date("Y-m-d",$mkt);
$end2= date("Y")."-".$input_month."-".date('t', strtotime($date2));
?>
<table>
<tr>
<?php while(strtotime($date2) <= strtotime($end2)) {
$day_num = date('d', strtotime($date2));
$day_name = date('l', strtotime($date2));
$date2 = date("Y-m-d", strtotime("+1 day", strtotime($date2)));
echo "<td>$day_num <br/> $day_name</td>";
}
?>
</tr>
</table>
在這裏,我想,例如,如果我選擇月「五一」,那麼它的值「05」我應該得到它,並把它分配給$ input_month使日期應顯示所選月份的日期名稱。獲得選擇一個月的價值,並打印日期
我應該通過什麼$ input_month =? $ month或$ value「 – akki
它給出了錯誤警告:mktime()期望參數4是長的,在第29行的E:\ xampp \ htdocs \ gg_hrms \ date-final.php中給出的數組。 注意:Array to string轉換在E:\ xampp \ htdocs \ gg_hrms \ date-final.php在線32 – akki
好吧,我只是更正了代碼,好吧等待我會給你完整的代碼。 –