Currently I have a form and when the user is entering data, this code calls another page to check if the username is in use. This is the code from the main page that calls the DB Page(test.php)
<script type="text/javascript">
function showHint(str)
{
if (str.length==0)
{
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;
if (xmlhttp.responseText.indexOf("green") != -1) {
document.getElementById("submit").disabled = false;
} else {
document.getElementById("submit").disabled = true;
}
}
}
xmlhttp.open("GET","test.php="+str,true);
xmlhttp.send();
}
</script>
I want to change this so when it calls test.php it passes a value to test.php based on what form field the user is entering into.
That way I can use test.php to perform diffident DB lookups depending on the form field the user is completing.
Can anyone help ? Thanks :)