如何从超过4个多选项中选择我想要的值

时间:2017-05-07 09:09:51

标签: php select

<h1> <font size=20% color=black>Room Choice </font><br></h1>
        	</div>
    <div class="form-group">
                	<hr />
                </div>
    <table width ="1100" align="center">
      <tr>
        <th><font size=4 color=black>Room Type</font></th>
        <th><font size=4 color=black>Description</font></th>
        <th><font size=4 color=black>Room(Cost)</font></th>
        <th><font size=4 color=black>Date</font></th>
      </tr>
      <tr>
        <td><img src="1.jpg" width="100" height="100" border="0"></td>
        <td><p style="color:Black;"><span class="glyphicon glyphicon-bed"></span>&nbsp;Single Bed</a></p>
        <font size=3 color=black>-Only provide 1 single bed.<br>
        -Max for 1 guest only.</font></td>
    <td><select name="sBed" class="available_rooms_ddl">
    <option value="0">0 (0.00$)</option>
    <option value="1-55">1 (55.00$)</option>
    <option value="2-110">2 (110.00$)</option>
    <option value="3-165">3 (165.00$)</option>
    <option value="4-220">4 (220.00$)</option>
    <option value="5-275">5 (275.00$)</option>
    <option value="6-330">6 (330.00$)</option>
    <option value="7-385">7 (385.00$)</option>
    <option value="8-440">8 (440.00$)</option>
    <option value="9-495">9 (495.00$)</option>
    <option value="10-550">10 (550.00$)</option></select></td>
        <td>From:<?php echo $checkIn = test_input($_POST["checkIn"]); ?><br> To:<?php echo $checkOut = test_input($_POST["checkOut"]); ?> </td></tr>
         <td><img src="2.jpg" width="100" height="100" border="0"></td>
        <td><p style="color:Black;"><span class="glyphicon glyphicon-bed"></span>&nbsp;2 Single Bed</a></p>
        <font size=3 color=black>-Provide 2 single bed.<br>
        -Max for 2 guest only.</font></td>
        <td><select name="tSBed" class="available_rooms_ddl">
    <option value="0">0 (0.00$)</option>
    <option value="1-80">1 (80.00$)</option>
    <option value="2-160">2 (160.00$)</option>
    <option value="3-240">3 (240.00$)</option>
    <option value="4-320">4 (320.00$)</option>
    <option value="5-400">5 (400.00$)</option>
    <option value="6-480">6 (480.00$)</option>
    <option value="7-560">7 (560.00$)</option>
    <option value="8-640">8 (640.00$)</option>
    <option value="9-720">9 (720.00$)</option>
    <option value="10-800">10 (800.00$)</option></select></td>
         <td>From:<?php echo $checkIn = test_input($_POST["checkIn"]); ?><br> To:<?php echo $checkOut = test_input($_POST["checkOut"]); ?> </td></tr>
       <tr>
        <td><img src="3.jpg" width="100" height="100" border="0"></td>
        <td><p style="color:Black;"><span class="glyphicon glyphicon-bed"></span>&nbsp;Double Bed</a></p>
        <font size=3 color=black>-Only provide 1 double bed.<br>
        -Max for 2 guest only.</font></td>
        <td><select name="dBed" class="available_rooms_ddl">
    <option value="0">0 (0.00$)</option>
    <option value="1-140">1 (140.00$)</option>
    <option value="2-280">2 (280.00$)</option>
    <option value="3-420">3 (420.00$)</option>
    <option value="4-560">4 (560.00$)</option>
    <option value="5-700">5 (700.00$)</option></select></td>
         <td>From:<?php echo $checkIn = test_input($_POST["checkIn"]); ?><br> To:<?php echo $checkOut = test_input($_POST["checkOut"]); ?> </td></tr>
       <tr>
        <td><img src="4.jpg" width="100" height="100" border="0"></td>
        <td><p style="color:Black;"><span class="glyphicon glyphicon-bed"></span>&nbsp;4-Bed Domitary</a></p>
        <font size=3 color=black>-Provide 4 single bed.<br>
        -Max for 4 guest only.</font></td>
        <td><select name="fBed" class="available_rooms_ddl">
    <option value="0">0 (0.00$)</option>
    <option value="1-30">1 (30.00$)</option>
    <option value="2-60">2 (60.00$)</option>
    <option value="3-90">3 (90.00$)</option>
    <option value="4-120">4 (120.00$)</option>
    <option value="5-150">5 (150.00$)</option>
    <option value="6-180">6 (180.00$)</option>
    <option value="7-210">7 (210.00$)</option>
    <option value="8-240">8 (240.00$)</option>
    <option value="9-270">9 (270.00$)</option>
    <option value="10-300">10 (300.00$)</option>
    <option value="11-330">11 (330.00$)</option>
    <option value="12-360">12 (360.00$)</option></select></td>

我想从这4个选项中进行选择..我需要做什么步骤才能区分我在这4个选项中选择哪个选项? 我搜索了许多帖子和非相关..我希望有人可以教我,因为我是PHP的新手 但是请将DONT设置为重复或者因为之前没有问过这个问题。

EDIT2:很多人可能会对我的问题感到困惑。好吧,我的问题是用户将选择为他们的房间预订。 select name是房间的类型,选项是用户想要的房间数 例如 <select name="sBed" class="available_rooms_ddl"> - &gt;这个“sBed”是房间的类型:单人床房。 <option value="2-110">2 (110.00$)</option> - &gt;值为2-110的此选项是用户选择的房间数= 2且成本为110 $。所以我的问题是......我应该用什么方法来检测房间类型和用户选择的房间数量

1 个答案:

答案 0 :(得分:0)

如果您需要从每个选择框多个选项

,请填写
<select name="sBed[]" multiple>

然后从表单动作php页面你可以得到

  

$ sBed = $ _POST [&#39; sBed&#39;]; print_r($ sBed);

同样其他三个也

希望这能解决您的问题