Hi,
I've been working on developing a site of mine for a while and finally got down to building a form.
http://whodateswhere.com/auto/index.php is what I am talking about.
I'm trying to have a list of all makes and models of cars show up in the list.
I have the file with all makes/models in the format like this
case "Acura":
echo json_encode(array("MDX","RDX","RL","TL","TSX","ZDX"));
return;
case "Audi":
echo json_encode(array("A3","A4","A5","A6","A8","Q5","Q7","R8","S4","S5","S6","TT","TTS"));
return;
I have the switch command at the top but I'm not sure any of it is correct.
In my index.php I have a jquery script like this
<script language="javascript" type="text/javascript">
$('#ajax_make_id').change(function(){
$.get('model.php',{ make: $(this).html() }, function(data){
$drop_down_data = get_options( $.parseJSON(data) );
$('#ajax_model_id').html( options );
});
});
function get_options( options_array )
{
var options = '';
for( var i in options_array )
options += '<option value="'+ options_array[i] +'">'
+ options_array[i] +'</option>';
return options;
}
</script>
and my form is set up like this
<form>
<div class="landing_quote_left">
<table cellpadding="0" cellspacing="8" border="0">
<tr>
<td>
<label for="ajax_make_id" class="landing_quote_label">Make:</label>
</td>
<td>
<span id="ajax_make_select"><select name="2f_make_id" id="ajax_make_id" style="width: 170px;" onchange=""><option value="999">Select a Make</option></select></span>
</td>
</tr>
<tr>
<td>
<label for="ajax_model_id" class="landing_quote_label">Model:</label>
</td>
<td>
<span id="ajax_model_select"><select name="2f_model_id" id="ajax_model_id" style="width: 170px;" onchange=""><option value="999">Select a Model</option></select></span>
</td>
</tr>
</table>
</div>
</form>
I just know none of this is correct though.
I'd really appreciate the help if you guys can help me get this solved. I've literally spent 20-30 hours or more on this single form 🙁