Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2011
    Posts
    95
    Thanks
    13
    Thanked 1 Time in 1 Post

    search database with more than 1 option!

    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:


    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>
    Last edited by garevn; 04-14-2011 at 09:16 PM.

  • #2
    New Coder
    Join Date
    Apr 2011
    Posts
    95
    Thanks
    13
    Thanked 1 Time in 1 Post
    solved thanks


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •