我已經成功把我的數據我的網頁的URL的形式:
http://localhost:8101/Tutorials/sandbox/myfiles/make_a_booking.php?period=2&date=04/29/2014&room=028
但我奮力將數據放入表格。但是,如何將period = 2放入單選按鈕,將room = 028放入選擇下拉菜單?
<form class="submit_date" method="post" action="insert.php" id="submit_date" onsubmit="return confirm('Confirm your booking?');">
<p>Date: <input type="text" name="datepicker" id="datepicker" required value="<?php echo $_GET['date'];?>"></p>
<input type="radio" name="bookperiod" id="bookperiod" value="1" required/>1<br>
<input type="radio" name="bookperiod" id="bookperiod" value="2" required/>2<br>
<input type="radio" name="bookperiod" id="bookperiod" value="3" required/>3<br>
<input type="radio" name="bookperiod" id="bookperiod" value="4" required/>4<br>
<input type="radio" name="bookperiod" id="bookperiod" value="5" required/>5<br>
<select class="dropdown" id="bookroom" name="bookroom" required;>
<option selected disabled hidden value=''></option>
<?php
for ($x=0; $x<sizeof($rooms_array); $x++)
{
echo "<option value='$rooms_array[$x]'>".$rooms_array[$x]."</option>";
}
?>
</select>
<input class="submit_btn" value="Submit" type="submit" name="Submit";/>
</form>
我試圖通過$ _GET放置房間= 028到選項,但它未工作,單選按鈕我不會知道從哪裏開始。
您檢查每個按鈕對應變量的值,如果它們匹配,則輸出html以標記檢查的輸入。 –