what is the best way to get the selected item from dropdown menu?
My dropdown menu is generated inside while loop if that matters 🙂
P.s. before you down-vote…I tried a couple of techniques I found on google and on this website.
Here is example of my dropdown menu:
<select id="select1">
<?php
$id = 0;
while ($row = mysql_fetch_row($result)) {
echo "<option value=$id>$row[0]</option>";
$id++;
}
?>
</select>
Just give it a
name:Then, when posted, you have the value available in
$_REQUEST['myselect'].