hi guyz
im new to HTML and CSS and i would to clarify the following doubt.
i have 2 pages
>index.php
>config.php
the index.php has a select box named "adamage", when i select the select box "atype" above, its supposed to change through AJAX and retrieve values (from a MySQL DB) for adamage according to atype
for eg. atype-art
adamage-frame, painting
atype-building
adamage-wall,door
The problem is that the AJAX works fine in all browsers, but the values cant get passed, also i cant get the selected value to be passed. :(
here is the Ajax code for config.php
<td>Area of damage :
<select name="adamage" style="width:205px">
<option >select damage type</option>
<? while($row=mysql_fetch_array($result)){ ?>
<option value>
<?=$row['adamage']?>
</option>
<? } ?>
</select></td>
which would overwrite index.php adamage
the Ajax retrieval code in the index.php are listed below
<script>
function getdamage(strURL) {
var req = getXMLHTTP();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById('damagediv').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
</script>
and....
<td>
<div class="mainleft">Article type: <select name="atype" onchange="getdamage('config.php?atype='+this.value)" style="width:205px">
<option value="">select article type</option>
<option value="1">Art</option>
<option value="2">Buildings</option>
</select></div>
</td>
<tr><td> </td></tr>
<td><div class="mainleft">
<div id="damagediv">
Area of damage : <select name="adamage" style="width:205px">
<option value="">select damage type</option>
</div></div>
</td>