未获取表单中select的值


Not get value of select in form

我有一个php格式的proplem。当我提交表单时,它不会得到select选项的值。我尝试了很多时间和方法,但都不起作用。请帮帮我。谢谢代码:

<form method="post" action="" id="form_search" >
<article class="module width_full">
<header><h3>Thống kê CCU</h3></header>
<div class="module_content">
<fieldset>
<label>Month</label>
<select name="month">
<?php
$stt=0;
$query=mysql_query("select DATE_FORMAT(date,'%m') as month from skycity_log.ccu_log GROUP BY month ORDER BY month ASC") or die (mysql_error());
while($row = mysql_fetch_array($query)){
echo"<option value='$row[month]'>$row[month]</option>";}?>
</select>
</fieldset>
<fieldset>
<label>Year</label>
<select name="year">
<?php
$query=mysql_query("select DATE_FORMAT(date,'%Y') as year from skycity_log.ccu_log GROUP BY year ORDER BY year ASC") or die (mysql_error());
while($row = mysql_fetch_array($query)){
echo"<option value='$row[year]'>$row[year]</option>";}
?>
</select>
</fieldset>
<div class="clear"></div>
</div>
<div class="submit_link">
<input type="submit" name="s_t" value="Search" class="alt_btn">
</div>
</article>
</form>
<?php
        if(isset($_POST['s_t'])){
            $month=$_POST['month'];
            $year=$_POST['year'];
            $date = $month."-".$year;
            $d=strtotime($date);
            echo date("Y-m",$d);
            }
         ?>

检查:当我在选择"月"中选择值=2,在选择"年"中选择数值="2015"并提交表格时,结果不="2015-02",结果="970-01"。为什么?

日期参数中缺少date部分。

试试这个:

  $month=$_POST['month'];
  $year=$_POST['year'];
  $date = "1-" . $month."-".$year;
  $d=strtotime($date);
  echo date("Y-m",$d);