I have a dropdown box which is populated through MySQL:
echo "<form>";<br>
echo "Please Select Your Event<br />";
echo "<select>";
$results = mysql_query($query)
or die(mysql_error());
while ($row = mysql_fetch_array($results)) {
echo "<option>";
echo $row['eventname'];
echo "</option>";
}
echo "</select>";
echo "<input type='submit' value='Go'>";
echo "</form>";
How do i make it that if one clicks submit it will display a value from a MySQL db
Thanks for the help
1) Give a name to your
<select>, i.e.<select name='event'>.2) Redirect your form to the display page (and set method POST):
<form method='POST' action='display.php'>3) just display the selected value:
<?php echo $_POST['event']; ?>If you want to use the same page, give a name to your submit button and then do this:
Hope it helps.