Click to See Complete Forum and Search --> : How to return a result from a drop down listbox in HTMl?


Josef_Stalin
March 5th, 2009, 06:32 PM
Hello.

Creating the box is easy enough.

<select><option> etc. etc. etc.

If you create the list box in a form, how do you return a result when someone clicks submit.

I'm already using PHP to read the listbox data out of mysql, but that won't be useful, because it runs on the server side, and by the time the user clicks the box and hits submit, the server has already calculated.

I'd prefer not to use Java or client side scripts but will if absolutely necessary.

PeejAvery
March 6th, 2009, 06:28 AM
Depends on whether you are using get or post as your method. Below is an example of post.

<?php
$select = $_POST['select_tag_name'];
?>

blueday54555
March 19th, 2009, 11:13 AM
there is no difference in submitting a Edit/Input field or a Drop-Down-List selection

form.html

..............
<form action="submit.php" method="post">
<select name="dropdown">
<option value="test1">test 1</option>
<option value="test2">test 2</option>
<option value="test3">test 3</option>
</select>
<input type="submit" />
</form>
.............


submit.php

..........
You selected <?php echo $_POST["dropdown"]; ?>.<br />
..........