-1
我希望從表格中提交年份的某個特定年份獲取月份列表。月份必須與月份的開始日期和最後日期一起提供。獲取特定年份的月份列表及其開始日期和結束日期
$year = $_POST['year'];
$current_year = date('Y');
for ($m=1;$m<=12;$m++)
{$month = date("F", mktime(0,0,0,$m,1,$year));
$nmonth = date("m",strtotime($month));
$days = cal_days_in_month(CAL_GREGORIAN,$nmonth,$year);
$sdate = mktime(0, 0, 0, $nmonth, 1, $year);
$edate = mktime(0, 0, 0, $nmonth, $days, $year);
//$edate = date("Y-m-t", strtotime($sdate));
echo strftime("$month $year").' - '.'Start date '.''.strftime(" %Y-%m-%d", $sdate).' '.'End date '.''.$edate.' - '.strtoupper(substr($month, 0, 3)).date("y",mktime(0,0,0,$nmonth,1,$year)).$days.'<br>';
//echo $month.' '.$days.' '.$sdate.' '.$edate.'<br>';
}
<body>
<form id="period" name="period" method="post" action="create_period.php">
<input type="text" name="year" id="year" />
<label>
<input type="submit" name="button" id="submit" value="Create Period" />
</label>
<input type="hidden" name="id" id="id" />
</form>
</body>
感謝名單@伊斯梅爾 - rbouh。你是一位天才 – user3315848
我感謝你的幫助。我在[link]有另一個問題(http://stackoverflow.com/questions/38684317/values-fail-to-insert-when-into-table-fields-when-posted) – user3315848