For your select, you could add an onchange attribute like this
<select name="makeselection" onchange="filtermodelselection()">
You add a function filtermodelselection(), which reads out the selected option from your makeselection like (give a name to your form, or an id to your select, I'll use "frm" now as formname)
var makeid=document.frm.makeselection.value;
You send your ajax request to the page. then with the makeid you can make an ajax request to the server like this : http://www.w3schools.com/ajax/tryit.asp?filename=tryajax_get_unique
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.frm.modelSelection.innerHTML=xmlhttp.responseText;
}
}
var makevalue=document.frm.makeSelection.value;
xmlhttp.open("GET","?ajaxmake="+makevalue,true);
xmlhttp.send();
}
On the server side you get a $_REQUEST['ajaxmake'] variable.
if (isset($_REQUEST['ajaxmake'])) {
//do the magic the query, and then echo like what you did here:
while ($rowModel = odbc_fetch_array($resultModel)) {
echo "<option value='$rowModel[Model]'>$rowModel[Model]</option>";
}
//then die, to not echo anything else accidentally
die();
}
example output:
<option value='AUDI'>AUDI</option>
<option value='BMW'>BMW</option>
on the recieving side, with ajax you give the recieved value from the server to the modelSelection's innerHTML.like:
document.frm.modelselection.innerHTML=xmlhttp.responseText;
If something is not clear, please feel free to ask.
EDIT: put this part:
<?php
if (isset($_REQUEST['ajaxmake'])) {
$resultModel = odbc_exec($conn, "SELECT Model FROM Vehicle") or die (odbc_errormsg());
while ($rowModel = odbc_fetch_array($resultModel)) {
echo "<option value='$rowModel[Model]'>$rowModel[Model]</option>";
}
die();
}
?>
to the beginning of the file. (after any includes, database connector codes of course)