The ajax code is showing data of country state city from database but doesnt works in mozilla firefox
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Registration-Form</title>
</head>
<script type="text/javascript">
function showstate(str,ob)
{
var xmlhttp;
if (str.length==0)
{
if(ob==1)
{
document.getElementById("state1").innerHTML="";
}
if(ob==2)
{
document.getElementById("city1").innerHTML="";
}
return str;
}
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)
{
if(ob==1)
{
document.getElementById("state1").innerHTML=xmlhttp.responseText;
}
else
{
document.getElementById("city1").innerHTML=xmlhttp.responseText;
}
//alert(document.getElementById("state1").value);
//alert(xmlhttp.responseText);
}
}
if(ob==1)
{
xmlhttp.open("POST","state.php?countryid="+str,true);
}
else
{
xmlhttp.open("POST","city.php?stateid="+str,true);
}
xmlhttp.send();
}
</script>
<body>
<form name="registration" method="post" action="registration.php?confirm=Y" autocomplete="off">
=""=$_GET[="Y"
<table align="center"><tr><td>Registration-Form</td></tr>
</table>
<table align="center">
<tr><td>UserName</td>
<td><input type="text" name="uname" /></td>
</tr>
<tr><td>Password</td>
<td><input type="password" name="pwd" /></td>
</tr>
<tr><td>Address</td>
<td><textarea name="address"></textarea>
</td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="email" />
</td>
</tr>
<tr>
<td>
Mobile
</td>
<td><input type="text" name="mobile" /></td>
</tr>
<tr>
<td>
Country
</td>
<td><select name="country" onchange="showstate(this.value,1);" id="country1">
="select id,name from country"=mysql_query($sql)=mysql_num_rows($query);
=1)
{
echo "<option value=''>Select</option>";
while($row=mysql_fetch_array($query))
{
?>
<option value="<?php echo $row['id'];?> "></option>
</select>
</td>
</tr>
<tr>
<td>
State
</td>
<td><div id="state1">
<select name="state">
<option value=""></option>
</select>
</div>
</td>
</tr>
<tr>
<td>
City
</td>
<td> <div id="city1">
<select name="city">
</select>
</div>
</td>
</tr>
<tr><td>PinCode</td>
<td><input type="text" name="pincode" />
</td>
</tr>
<tr><td></td>
<td><input type="submit" name="submit" value="submit" />
</td>
</tr>
=$_POST[=$_POST[=$_POST[=$_POST[=$_POST[=$_POST[<b>User Registered Successfully</b></center>";
}
?>
</form>
</body>
</html>
ow['id'];?> "><?php echo $row['name']?></option>
<?php
}
}
?>
</select>
</td>
</tr>
<tr>
<td>
State
</td>
<td><div id="state1">
<select name="state">
<option value=""></option>
</select>
</div>
</td>
</tr>
<tr>
<td>
City
</td>
<td> <div id="city1">
<select name="city">
</select>
</div>
</td>
</tr>
<tr><td>PinCode</td>
<td><input type="text" name="pincode" />
</td>
</tr>
<tr><td></td>
<td><input type="submit" name="submit" value="submit" />
</td>
</tr>
<?php
}
else
{
//echo "$confirm";
$uname=$_POST["uname"];
$pwd=$_POST["pwd"];
$address=$_POST["address"];
$email=$_POST["email"];
$mobile=$_POST["mobile"];
$pincode=$_POST["pincode"];
mysql_query("insert into signup(username,password,address,email,mobile,pincode) values('$uname','$pwd','$address','$email','$mobile','$pincode')") or die(mysql_error());
echo "<center><b>User Registered Successfully</b></center>";
}
?>
</form>
<?php
function getstate()
{
}
?>
</body>
</html>