I have a drop down box and the test box for the search field. In there I user only dropdown box to search values from the DB. But now I want to pass text box value with dropdownbox value. How can I do that? This is my working php code for only dropdown search.
This is my ajax code
Code:
<table width="508" align="center" border="0"> <form> <tr> <td width="169"> <select name="users" onchange="showUser(this.value);"> <option value="1">Name</option> <option value="2">Number</option> <option value="3">Phone Number</option> <option value="4">Email Address</option> </select> </td> <td colspan="2" ><input name="search" type="text" size="40" value=""/></td> <td width="76"><input src="images/Search.jpg" type="image" alt="Confirm" name="search" /></td> </tr> </form> </table><?php ?> <div id="txtHint"></div>
Code:
function showUser(str)
{
req= GetXmlHttpObject();
var url="User.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
req.onreadystatechange=stateChanged;
req.open("GET",url,true);
req.send(null);
}
function stateChanged()
{
if (request.readyState==4)
{
document.getElementById("txtHint").innerHTML=request.responseText;
}
}
Comment