after testing i found out that the problem is as you said andrea is not in the xmlHttp request.
Code:
<?php
$q=$_GET["q"];
$con = mysql_connect('s', 'u', 'p');
if (!$con)
{
die($ERROR_CONNECTING_MYSQL . mysql_error());
}
mysql_select_db("world", $con);
$sql="SELECT DISTINCT City FROM geoinfo WHERE country = '".$q."'";
$result = mysql_query($sql);
echo "<option>Select a City</option>";
while($row = mysql_fetch_array($result))
{
echo "<option value =\"" . $row['City'] . "\">" . $row['City'] . "</option>";
}
echo "<option value = Other...>(City not listed - Click here)</option>";
mysql_close($con);
?>
the above response is suppose to go to
Code:
document.getElementById('P_City').innerHTML=xmlHttp.responseText
where P_City is an id of a <select> tag. it works in all browsers but not in IE.
The only way to make it work in IE is by changing the PHP code to
Code:
<?php
$q=$_GET["q"];
$con = mysql_connect('s', 'u', 'p');
if (!$con)
{
die($ERROR_CONNECTING_MYSQL . mysql_error());
}
mysql_select_db("world", $con);
$sql="SELECT DISTINCT City FROM geoinfo WHERE country = '".$q."'";
$result = mysql_query($sql);
echo "<select>";//CHANGE
echo "<option>Select a City</option>";
while($row = mysql_fetch_array($result))
{
echo "<option value =\"" . $row['City'] . "\">" . $row['City'] . "</option>";
}
echo "<option value = Other...>(City not listed - Click here)</option>";
echo "</select>";//CHANGE
mysql_close($con);
?>
and creating a new <div> tag to load the above response text in
Code:
document.getElementById('NEWP_City').innerHTML=xmlHttp.responseText
which means that i must first remove the <select> tag from the html page and load the whole tag dynamically. but can not load the <options> only .
Is this an error in IE or do i need to update my IE..??
hope this is clear enough.
kimoo
Bookmarks