doulu2591 2014-08-22 21:48
浏览 20
已采纳

将数据从投递箱输入文本框?

Hi i am wondering how to get the value selected in my dropdown box to be inputted into the option 'Booking Confirmation' (on the page it will navigate to) once i click submit.

<form name="add_table" method="post" action="form.php" >
<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  </head>
  <body>
    <div style="display:block;">

    Seat:<br />
    A
        <select>
            <option>01</option>
            <option>02</option>
             <option>03</option>
              <option>04</option>
               <option>05</option>
            <option>06</option>
            <option>07</option>
            <option>08</option>
            <option>09</option>
            <option>10</option>


            </div>


 </body>
</html>
<tr><td><input type="submit" value="Add" name=""></td></tr></table></form>

Here is the following code that contains the Booking Confirmation option. I want the selected value from the dropdown box to be automatically inputted into the 'Booking confirmation' text box.

<form name="add_table" method="post" action="add.php" >
<table border=0>
<tr><td>Name: </td><td><input type="text" name="name" ></td></tr>
<tr><td>Surname: </td><td><input type="text" name="surname" ></td></tr>
<tr><td>Email Address: </td><td><input type="text" name="emailaddress" ></td></tr>
<tr><td>Mobile Phone Number: </td><td><input type="text" name="mobilephone" ></td></tr>
<tr><td>Credit Card Details: </td><td><input type="text" name="creddetails" ></td></tr>
<tr><td>Date of booking: </td><td><input type="text" name="date" ></td></tr>
<tr><td>Booking Confirmation: </td><td><input type="text" name="bookingconfirmation" ></td></tr>
<tr><td><input type="submit" value="Add" name=""></td></tr></table></form>
  • 写回答

1条回答 默认 最新

  • douh9817 2014-08-22 21:52
    关注

    Give your select box a name:

    <select name="something">
    

    In the PHP of the page you navigate to (Assuming you're posting to this page through a form). Do this:

    <input type="text" name="bookingconfirmation" value="<?php echo htmlentities($_POST['something']); ?>">
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退
  • ¥20 win系统的PYQT程序生成的数据如何放入云服务器阿里云window版?
  • ¥50 invest生境质量模块
  • ¥15 nhanes加权logistic回归,svyglm函数