Hi. Here's my problem.
I have two tables. One is a main category table and the other is a subcategory table.
The main category table has the fields (catID and catName)
The Subcategory table has the fields (catId, SubId and SubName)
The two are related via the catId field..
I can't figure out how to dynamically load the second drop down menu from the choice made in the first drop down menu.. If anybody can point out whats wrong, it would be nice Thanks.
<?php require_once('Connections/antiques.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_antiques, $antiques);
$query_Recordset1 = "SELECT items.ItemId, items.BuyingPrice, items.SellingPrice FROM items";
$Recordset1 = mysql_query($query_Recordset1, $antiques) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR...ml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<label></label>
<select name="choosemenu" id="choosemenu" title="<?php echo $_POST['ChooseMenu']; ?>" onchange="MM_jumpMenu('parent',this,0)">
<option value="">Choose Antique Type</option>
<?php
do {
?>
<option value="<?php echo $row_Recordset1['ItemId']?>"><?php echo $row_Recordset1['ItemId']?></option>
<?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
?>
</select>
<label>
<input type="submit" name="Submit" id="Submit" value="Submit" />
</label>
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>