DBookatay Posted April 2, 2013 Share Posted April 2, 2013 I know how to populate one select box based on the option from another using jquery and ajax, but how do you do it when the select boxes are arrays? By default there are 10 rows on the page, however I also am using .EnableMultiField() to add more lines as I need them... On any given week we add between 10 to 30 vehicles into our inventory. Ajax: $(".make").change(function() { var id=$(this).val(); var dataString = 'id='+ id; $.ajax ({ type: "POST", url: "get_models.php", data: dataString, cache: false, success: function(html) { $(".model").html(html); } }); }); And the php <ul> <li>Year <select name="year[]"><option></option>'.$Year.'</select></li> <li>Make <select name="make[]" class="make"><option></option>'.$Make.'</select></li> <li>Model <select name="model[]" class="model" style="width: 120px"><option></option>'.$Model.'</select></li> <li>Trim <input type="text" size="10" name="trim[]" /></li> <li>VIN <input type="text" name="vin[]"size="20" maxlength="17" onkeyup="return Upper(event,this)" /></li> <li>Mileage <input type="text" name="mileage[]" size="3" maxlength="6" /></li> <li>Color <select name="color[]"><option></option>'.$Color.'</select></li> <li>Cost <input type="text" name="cost[]" size="6" maxlength="6" onchange="currency(this)" /></li> <li>Asking <input type="text" name="asking[]" size="6" maxlength="6" onchange="currency(this)" /></li> </ul> Link to comment https://forums.phpfreaks.com/topic/276443-populating-one-select-box-based-on-another-when-selects-are-arrays/ Share on other sites More sharing options...
DBookatay Posted April 3, 2013 Author Share Posted April 3, 2013 No one hunh! Link to comment https://forums.phpfreaks.com/topic/276443-populating-one-select-box-based-on-another-when-selects-are-arrays/#findComment-1422564 Share on other sites More sharing options...
DBookatay Posted April 3, 2013 Author Share Posted April 3, 2013 http://www.login.carcityofdanbury.com/New/01/add.php Link to comment https://forums.phpfreaks.com/topic/276443-populating-one-select-box-based-on-another-when-selects-are-arrays/#findComment-1422685 Share on other sites More sharing options...
DBookatay Posted April 4, 2013 Author Share Posted April 4, 2013 http://stackoverflow.com/questions/15755418/populating-one-select-box-based-on-another-when-selects-are-arrays Link to comment https://forums.phpfreaks.com/topic/276443-populating-one-select-box-based-on-another-when-selects-are-arrays/#findComment-1422796 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.