code:<html>
<head>
<script>
function showUser(str)
{
if (str=="")
{
document.getElementById("txtHint").innerHTML="";
return;
}
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)
{
document.getElementById("txtHint").outerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","getuser.php?id="+str,true);
xmlhttp.send();
}
</script>
</head>
<body>
<form>
<select name="id" onChange="showUser(this.value)">
<option value="">Select a person:</option>
<option value="1">1</option>
</select>
</form>
<br>
</body>
<div id="txtHint"><b></b></div>
</html>
<?php
if(isset($_GET['id']))
{
echo "this is id". $_GET['id'];
}
?>
Question:
The result is create with another one listbox. how to avoid that?