hi, very new to this php and ajax world, just learning it as a personal project... I am currently trying to put together two drop down menu items, of car makes and when a make is selected it picks a model..
here's the code I have for both files
<html>
<head>
<title>Selentry5 test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
function getXMLHTTP() { //fuction to return the xml http object
var xmlhttp=false;
try{
xmlhttp=new XMLHttpRequest();
}
catch(e) {
try{
xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e1){
xmlhttp=false;
}
}
}
return xmlhttp;
}
function getModel(strURL) {
var req = getXMLHTTP();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById('citydiv').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
</script>
</head>
<body>
And for findmodel.php
<?php
include ("dbconnect.php");
doDB();
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
} else {
$make=$_REQUEST['make'];
$query="select model from car_makes where car_make=$make";
$result=mysql_query($query);
?>
<select name="model">
<option>Select Model</option>
<? while($row=mysql_fetch_array($result)) { ?>
<option value><?=$row['car_model']?></option>
<? } ?>
</select>
when I load this, it produces the two drop down boxes but I get nothing in the model drop down??????
any help on this will really be appreciated...