Jump to content

please help


narjis

Recommended Posts

In the followinfg code I want to show second drop down list when a choice is selected from the first drop down list. Ca'nt find what the problem is.

<!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>
<script type="text/javascript">
function showSecond(str)
{
var xmlHttp ;
if(window.XMLHttpRequest)
{
xmlHttp = new XMLHttpRequest();
}
else {
xmlHttp= new ActivXObject("Microsoft.XMLHTTP");
}
if(xmlHttp.readystate==0 && xmlHttp==200){
document.getElementById("second").innerHTML = xmlHttp.responseText;
}

xmlHttp.open("GET", "showCity.php?q="+str,true);
xmlHttp.send();

}

</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Showing Cities</title>
</head>

<body>
<form>
Select the country 
<select name ="country" onchange=showSecond(this.value)>
<option value="Pakistan">Pakistan</option>
<option value="Iran">Iran</option>
<option value="India">India</option>
<option value="England">England</option>
</select>
<p>
<span id="second">  </span></p>
</form>
</body>
</html>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/237491-please-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.