由于某种原因,我无法让 php 将 HTML 表单输入识别为日期。
我有以下 HTML 表单:
<form action="Input.php" method="post">
Depature Date:
<select name="DMonth">
<option>- Select Month -</option>
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
<select name="DDay">
<option>- Select Day -</option>
<option value="01">1</option>
<option value="02">2</option>
<option value="03">3</option>
<option value="04">4</option>
<option value="05">5</option>
<option value="06">6</option>
<option value="07">7</option>
<option value="08">8</option>
<option value="09">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
<select name="DYear">
<option>- Select Year -</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
<option value="2016">2016</option>
<option value="2017">2017</option>
<option value="2018">2018</option>
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
<option value="2022">2022</option>
</select><br>
Departure Time: <select name="DHour" input type="number">
<option>- Select Hour -</option>
<option value="00">12 a.m.</option>
<option value="01">1 a.m.</option>
<option value="02">2 a.m.</option>
<option value="03">3 a.m.</option>
<option value="04">4 a.m.</option>
<option value="05">5 a.m.</option>
<option value="06">6 a.m.</option>
<option value="07">7 a.m.</option>
<option value="08">8 a.m.</option>
<option value="09">9 a.m.</option>
<option value="10">10 a.m.</option>
<option value="11">11 a.m.</option>
<option value="12">12 p.m.</option>
<option value="13">1 p.m.</option>
<option value="14">2 p.m.</option>
<option value="15">3 p.m.</option>
<option value="16">4 p.m.</option>
<option value="17">5 p.m.</option>
<option value="18">6 p.m.</option>
<option value="19">7 p.m.</option>
<option value="20">8 p.m.</option>
<option value="21">9 p.m.</option>
<option value="22">10 p.m.</option>
<option value="23">11 p.m.</option>
</select>
<select name="DMin">
<option>- Select Minute -</option>
<option value="00">00</option>
<option value="15">15</option>
<option value="30">30</option>
<option value="45">45</option>
</select>
<br>
<input type="submit" value="Submit">
</form>
和以下PHP:
$DCity=(int) $_POST["DCity"];
$ACity=(int) $_POST["ACity"];
$DMonth=(int) $_POST["DMonth"];
$DDay=(int) $_POST["DDAY"];
$DYear=(int) $_POST["DYear"];
$DHour=(int) $_POST["DHour"];
$DMin=(int) $_POST["DMin"];
$DTime = mktime($DHour, $DMin, 0, $DMonth, $DDay, $DYear);
print date(DATE_RFC822, $DTime);
我应该从中获得的回报应该反映在表格中输入的任何内容,但是返回的只是当前日期和时间。我的代码某处有错误吗?我尝试了多种 php 时间方法,但都返回当前日期而不是 HTML 表单中输入的日期。