A
Anonymous
Guest
I am having a hard time figuring out how to get this sript to work right. It is an AJAX function that is supposed to populate a dropdown box called Insect Family based on the selection made from the dropdown box for Insect Order. Then I want to submit the Insect Ffamily information and retrieve the record from the database. Problem is, I don't have my form right and don't know how the information is being passed along. I assumed that I would have the $_GET['familyID'] filled with the family ID for the selection when the submit button was pressed, but it doesn't seem to be working right. Here is the code:
Let me know what I am doing wrong. I currently get Notice: Undefined index: familyID in C:\Program Files\Apache Group\Apache2\htdocs\fizzyfish\functions\order_to_family.php on line 2. Then after that everything seems to work ok. The dropdowns are correct. I just can't seem to figure out how to actually retrieve the information from them.
Thanks in advance!
Fishermanjuice
Code:
<?php
$familyID = $_GET['familyID'];
echo $familyID;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Order to Family</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
div.elem {margin: 20px; }
</style>
<script language="javascript" type="text/javascript">
</script>
</head>
<body>
<h3>Select An Insect Order</h3>
<form action="AJAX_order_to_family.php" method="get">
<div class="elem">
<select onchange="populateList()">
<?php
//connect to the database
include ('mysql_connect.php');
//select all of the names of orders available
$get_orders = "select * from insect_order";
$order_names = mysql_query($get_orders, $conn) or die(mysql_error());
$options = "<OPTION value=\"--\">SELECT ONE</OPTION>";
//display order_names as options in the select box
WHILE($newArray = mysql_fetch_array($order_names)) {
$id = $newArray['orderID'];
$name = $newArray['order_name'];
$options .= "<OPTION value = \"$id\">$name</OPTION>";
}
echo $options;
?>
</select>
</div>
<h3>families:</h3>
<div class="elem" id="families">
<select name="familyID">
</select>
</div>
<input type="hidden" name="op" value="select">
<input type="submit" name="submit" value="Select Family">
</form>
</body>
</html>
Let me know what I am doing wrong. I currently get Notice: Undefined index: familyID in C:\Program Files\Apache Group\Apache2\htdocs\fizzyfish\functions\order_to_family.php on line 2. Then after that everything seems to work ok. The dropdowns are correct. I just can't seem to figure out how to actually retrieve the information from them.
Thanks in advance!
Fishermanjuice