Hi I'm performing the following query on a database which is getting me a dropdown menu. I want this to query the database onchange so that I can use that information in another form.
$dropdown_sql="SELECT product_id, product_name, unit_price, unit_quantity, in_stock FROM products";
$dropdown_result=mysql_query($dropdown_sql);
$options="";
while ($row=mysql_fetch_array($dropdown_result)) {
$id=$row["product_id"];
$product_name=$row["product_name"];
$unit_price=$row["unit_price"];
$unit_quantity=$row["unit_quantity"];
$in_stock=$row["in_stock"];
$options.="<OPTION VALUE=\"$id\">$product_name - $unit_quantity";
}
?>
The dropdown menu:
<SELECT NAME=product_name onchange="dropdown_change()">
<OPTION VALUE=0>Select a food
<?php echo $options ?>
</SELECT>
I can detect the change in javascript
function dropdown_change()
{
alert("hello")
}
BUT I can't get the information from that point, and the I can't put it in the form. Please help.