View Full Version : Retrieve User Selected Drop Down Menu Item with $_Get


Gnome_101
05-24-2005, 01:39 PM
How do I Retrieve User Selected Drop Down Menu Item with $_GET ? or $_POST

I understand that I can get a variable from a $_POST['vari_name'], but how do I get a listed variable.

Here is some code to help explain the situation...



$get_table="SELECT * FROM control.current_tables ORDER BY table_name";
mysql_select_db("control");
$tables=mysql_query($get_table);

?>

<p>&nbsp;</p>
<table width="100%" border="0" cellpadding="1">
<form name="submit" method="post" action="add2.php">
<input type="hidden" name="action" value="submitted">
<tr>
<td colspan="2"><div align="center"><strong>Data Entry Form - Step1 </strong></div></td>
</tr>
<tr>
<td width="24%">Category to add part to: </td>
<td width="76%"><select name="select" size="1">
<?php
while($row = mysql_fetch_assoc($tables))
{
$value=$row['table_name'];
echo "<option value=\"$value\">$value</option>";
}
?>


On the next page, add2.php, I need to have the selection they chose.

Thanks for the help!

Kris

SEO Aaron
05-26-2005, 08:34 AM
$_POST['select']

The name of the select will have the value they selected.

<select name="select" size="1">

hope that helps...

Gnome_101
05-29-2005, 08:24 AM
yeah! Thats the code I ended up finding somewhere on another site.

Thanks for the help thought!