stockychaser Posted February 27, 2011 Share Posted February 27, 2011 Hi All, I have 2 tables: one CarMake - CarMakeID - CarMakeDesc two CarModel - CarModelID - CarModelMake - CarModelDesc Depending on what the user selects in the first dropdown (carmake) the possible selection in the second dropdown (model) needs to be limited to only the models from the selected carmake. in the second table (Carmodel : the 'CarModelMake' = CarMakeID, to identify the make) How do I limit the dropdown 'CarModel' based on the selected CarMake in the first dropdown. link : http://98.131.37.90/postCar.php code : -- -- -- <label> <select name="carmake" id="CarMake" class="validate[required]" style="width: 200px;"> <option value="">Select CAR MAKE...</option> <?php while($obj_queryCarMake = mysql_fetch_object($result_queryCarMake)) { ?> <option value="<?php echo $obj_queryCarMake->CarMakeID;?>" <?php if($obj_queryCarMake->CarMakeID == $CarAdCarMake) { echo 'selected="selected"'; } ?> > <?php echo $obj_queryCarMake->CarMakeDesc;?></option> <?php } ?> </select> </label> <label> <select name="carmodel" id="CarModel" class="validate[required]" style="width: 200px;"> <option value="">Select MODEL...</option> <?php while($obj_queryCarModel = mysql_fetch_object($result_queryCarModel)) { ?> <option value="<?php echo $obj_queryCarModel->CarModelID;?>" <?php if($obj_queryCarModel->CarmodelID == $CarAdCarModel) { echo 'selected="selected"'; } ?> > <?php echo $obj_queryCarModel->CarModelDesc;?></option> <?php } ?> </select> </label> I'm a novice.. and appreciates all the help ! Quote Link to comment https://forums.phpfreaks.com/topic/229059-second-drop-down-depending-on-first-drop-down-selection/ Share on other sites More sharing options...
flolam Posted February 27, 2011 Share Posted February 27, 2011 That's a Javascript, not a PHP issue. Quote Link to comment https://forums.phpfreaks.com/topic/229059-second-drop-down-depending-on-first-drop-down-selection/#findComment-1180510 Share on other sites More sharing options...
floridaflatlander Posted February 27, 2011 Share Posted February 27, 2011 http://ago.tanfa.co.uk/css/examples/menu/tutorial-h.html ... I think you can make it work with this Quote Link to comment https://forums.phpfreaks.com/topic/229059-second-drop-down-depending-on-first-drop-down-selection/#findComment-1180517 Share on other sites More sharing options...
flolam Posted February 27, 2011 Share Posted February 27, 2011 If I understand correctly, she/he needs something completely different. More like this http://www.9lessons.info/2010/08/dynamic-dependent-select-box-using.html Quote Link to comment https://forums.phpfreaks.com/topic/229059-second-drop-down-depending-on-first-drop-down-selection/#findComment-1180526 Share on other sites More sharing options...
stockychaser Posted February 28, 2011 Author Share Posted February 28, 2011 Hi Flolan... you are right.. that is exactly what I need ! I will look into that and see if I can make this work. thanks for the tip ! Quote Link to comment https://forums.phpfreaks.com/topic/229059-second-drop-down-depending-on-first-drop-down-selection/#findComment-1180700 Share on other sites More sharing options...
floridaflatlander Posted February 28, 2011 Share Posted February 28, 2011 Duh, I didn't read all of the question, sorry, I liked flolam's link too, also this might help http://www.mattkruse.com/javascript/dynamicoptionlist/ Quote Link to comment https://forums.phpfreaks.com/topic/229059-second-drop-down-depending-on-first-drop-down-selection/#findComment-1180735 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.