hi there bstonehill ive done something like this with a javascript function that submits the form when the select box value changes
CODE
<script language="javascript">
function reload(form)
{
var val=form.cat.options[form.cat.options.selectedIndex].value;
var val2=form.subcat.options[form.subcat.options.selectedIndex].value;
var val3=form.subcat1.options[form.subcat1.options.selectedIndex].value;
self.location='dd.php?cat=' + val + '&subcat=' + val2 + '&subcat1=' + val3;
}
</script>
as you can see thats the javascript function above that when the form reloads, its takes the value from each of the selects and stores then in val. i have done this to work with 3 dynamic selects but the only trouble i have with this is the fact that i cant get the value of all three to save in the end and create a SQL statment out of them all as it only seems to save the last select box that has been changed.
here is the rest of the code for the page
CODE
</head>
<body>
<div id="wrapper">
<div id="header">
<h1>Tomorrow's Toys Today</h1>
</div>
<div id="subheader">
<?php include 'submenu.php'?>
</div>
<div id="leftmenu">
<?php
$cat=@$_GET['cat'];
$subcat=@$_GET['subcat'];
$subcat1=@$_GET['subcat1'];
///////// Getting the data from Mysql table for first list box//////////
@$quer=mysql_query("SELECT * FROM Manufacturer");
///////////// End of query for first list box////////////
/////// for second drop down list we will check if category is selected else we will display all the subcategory/////
if(isset($cat) and strlen($cat) > 0){
@$quer2=mysql_query("SELECT Product_name FROM Product where Manu_id = '$cat'");
}else{$quer2=mysql_query("SELECT Product_name FROM Product where Manu_id= '$cat'"); }
////////// end of query for second subcategory drop down list box ///////////////////////////
///// third drop down box query again check if the category has been selected else we will display all the subcategory////
if(isset($subcat) and strlen($subcat) > 0){
@$quer3=mysql_query("SELECT Capacity FROM Product where Product_name = '$subcat'");
}else{$quer3=mysql_query("SELECT Capacity FROM Product where Product_name= '$subcat'"); }
//end of form////
echo "<form method=post name=f1 action='dd-check.php'>";
echo "<table> <tr><td>";
////////// Starting of first drop downlist /////////
echo "Manufacturer";
echo"</td><td>";
echo "<select name='cat' onchange=\"reload(this.form) \"><option value=''>Select one</option>";
while($noticia = mysql_fetch_array($quer)) {
if($noticia['Manufacturer=']==$cat){
echo "<option value='$noticia[Manu_id]'>$noticia[Manufacturer]</option>"."<BR>";}
else{
echo "<option value='$noticia[Manu_id]'>$noticia[Manufacturer]</option><br>";}
}
echo "</select></td></tr><tr><td>";
////////////////// This will end the first drop down list ///////////
////////// Starting of second drop downlist /////////
echo "Product Name";
echo "</td><td>";
echo "<select name='subcat' onchange=\"reload(this.form) \"><option value=''>Select one</option>";
while($noticia2 = mysql_fetch_array($quer2)) {
if($noticia2['Product_name=']==$subcat){
echo "<option value='$noticia2[Product_name]'>$noticia2[Product_name]</option>"."<BR>";}
else{
echo "<option value='$noticia2[Product_name]'>$noticia2[Product_name]</option>";}
}
echo "</select></td></tr><tr><td>";
////////////////// This will end the second drop down list ///////////
//// starting third drop down list//////
echo " Capacity ";
echo "</td><td>";
echo "<select name='subcat1' onchange=\"reload(this.form) \"><option value=''>Select one</option>";
while($noticia3 = mysql_fetch_array($quer3)) {
echo "<option value='$noticia3[Capacity]'>$noticia3[Capacity]</option><br>";
}
echo "</select></td></tr><tr><td>";
echo "<input type=submit value=Show></td></tr></table>";
echo "<input type=text name=cats value=$cat>";
echo "</form>";
?>
</div>
<div id="main">
<h1>how to use this method</h1>
as you can see this method uses dynamic drop down boxes so when you make the first selection from the first drop down box the others will fill in with the previous selection.
</div>
</div>
if anybody might know how to adapt this at all ive tried looking into ajax but im kinda stuck on it so if there is anybody out there who could break it down for me as how to do it in ajax i would be much appreciated.
but i hope this helps you out with what you need.
Dan