...

View Full Version : search database with more than 1 option!



garevn
04-14-2011, 09:12 PM
Hello according to this
http://www.w3schools.com/php/php_ajax_database.asp
I prepared mine search which works fine. it displays which products are intel and which amd for example. I wonder how can i add a second similar search for sochet or something else,but not separate one for example if i have selected the intel as 1st option then choosing my 2nd one it display only intel products.

Here is my current code:



<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","kailoipa.php?q="+str,true);
xmlhttp.send();
}
</script>
</head>
<body>

<form>
<select name="products" onchange="showUser(this.value)">
<option value="">Select a person:</option>
<option value="intel">intel</option>
<option value="amd">amd</option>
</select>
</form>
<br />
<div id="txtHint"><b>Person info will be listed here.</b></div>

</body>
</html>

garevn
04-19-2011, 04:46 AM
solved thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum