doulu2591
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
    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']); ?>">
    
    点赞 评论

相关推荐