Hey, i am about to make a form which should contain 4 dropdownlists... And by dropdownlists i mean selects in html/php - the "preview" of what i am thinking about, there's a link in the bottom, so you can get a better understanding of what i am talking about.
I've been searching for some, and i found this code in a tutorial, it is working and all this, but i would like to have 4 dropdownlists instead of only 2. I have seen some without querystring, but this code is with querystring, and i'm not quite the best at php, but i understand a lot, thats not a problem, but problem is, that i would like to get rid of querystring and get 2 more dropdownlist, but i don't know the way to do it.
it's not a problem to get 2 more dropdownlist, but to get 2 more dropdownlist working like the link in the bottom.
I want it to work so i have to choose the first dropdownlist and rest are disabled or just empty, and when i choose in the first dropdownlist the second dropdownlist will be enabled or filled with data which is connected with the first like, a car and in the next BMW etc. should show up, and then when you have choosed in the second dropdownlist, the third dropdownlist will be enabled or filled with data just like the second one, but now if you choose BMW you should pick a model like M5 or M3 etc. and when you have done that, you will be able to pick the engine of the M5 or M3 or whatever you are choosing.
///////// Getting the data from Mysql table for first list box//////////
$quer2="SELECT DISTINCT category,cat_id FROM category order by category";
///////////// 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){
$quer="SELECT DISTINCT subcategory FROM subcategory where cat_id=$cat order by subcategory";
}else{$quer="SELECT DISTINCT subcategory FROM subcategory order by subcategory"; }
////////// end of query for second subcategory drop down list box ///////////////////////////
echo "<form method=post name=f1 action='dd-check.php'>";
/// Add your form processing page address to action in above line. Example action=dd-check.php////
////////// Starting of first drop downlist /////////
echo "<select name='cat' onchange=\"reload(this.form)\"><option value=''>Select one</option>";
foreach ($dbo->query($quer2) as $noticia2) {
if($noticia2['cat_id']==@$cat){echo "<option selected value='$noticia2[cat_id]'>$noticia2[category]</option>"."<BR>";}
else{echo "<option value='$noticia2[cat_id]'>$noticia2[category]</option>";}
}
echo "</select>";
////////////////// This will end the first drop down list ///////////
////////// Starting of second drop downlist /////////
echo "<select name='subcat'><option value=''>Select one</option>";
foreach ($dbo->query($quer) as $noticia) {
echo "<option value='$noticia[subcategory]'>$noticia[subcategory]</option>";
}
echo "</select>";
////////////////// This will end the second drop down list ///////////
//// Add your other form fields as needed here/////
echo "<input type=submit value=Submit>";
echo "</form>";
?>
Like i mentioned earlier, i have been searching for some results, and then i also found this. This is what i am talking about, this is without querystring, and is doing exactly what i would like to. I have tried looking into the code (F12) but can't find some php or javascript or jquery.