Help regarding dynamic fields + AJAX

Hi,

I am new to AJAX. I have a MySQL database with list of categories and subcategories. I have created a table where the first column contains the list pf categories and the second column calls the subcategories from an external php page called subcats where i echo the subcats.

I used xmlhttp.open for the <div id=“getsubcats”> this is the second column.

I have a form below the table. I want to change the form fields ased on subcat selection. How do i do that?

Thanks.

post your code so we can see what is going on.

this is my code :

<html>
<head>
<script type="text/javascript">
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").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getuser1.php?q="+str,true);
xmlhttp.send();
}
</script>
</head>
<body>
<table> <tr> <td>
<form>
<select name="users" onchange="showUser(this.value)" size="9">
<option value="">Select a person</option>
<option value="1">Name1</option>
<option value="2">Name2</option>
<option value="3">Name3</option>
<option value="4">Name4</option>
<option value="5">Name5</option>
<option value="6">Name6</option>
<option value="7">Name7</option>

</select>
</form>  </td> <td valign="top">
<div id="txtHint"><b>Person info will be listed here.</b></div>
</td> </tr> </table>