-2
       if(isset($_POST['submit_event'])){
               $m = $_POST['event_month']; 
               $y = $_POST['event_year'];
               $d = $_POST['event_day'];


              $date = date('Y-n-d',strtotime($y. '-' .$m. '-' .$d));
              echo $date;
                          //i always get 2013-10-07
        }

尽管输出总是错误且相同,但我输入的所有数据都是正确的。

4

1 回答 1

1
if (isset($_POST['submit_event']) && isset($_POST['event_month']) && isset($_POST['event_year']) && isset($_POST['event_day'])) {
  $m = $_POST['event_month']; 
  $y = $_POST['event_year'];
  $d = $_POST['event_day'];
  $date_pre = $y. '-' .$m. '-' .$d;
  $time = strtotime($date_pre)
  $date = date('Y-n-d', $time);
  echo $date;
}
// For debugging:
else {
   echo "Not all variables have been set."
}
于 2013-10-06T02:27:57.933 回答