<?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
好吧,我只是更正了代码,好吧等待我会给你完整的代码。 –