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>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <div style="display:block;">

    Seat:<br />


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