Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <script>
- function showCustomer(str)
- {
- var xmlhttp;
- 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","getcustomer.php?q="+str,true);
- xmlhttp.send();
- }
- </script>
- </head>
- <body> <form action="">
- <?php
- include "koneksi.inc.php";
- $sql=mysql_query("SELECT * FROM `customer` ") or die('Error, query failed. ' . mysql_error());
- while ($data=mysql_fetch_array($sql))
- {?>
- <li><a href="#?id=<?php echo $data['CS_ID'];?>" onChange="showCustomer(this.value)" ><?php echo $data['CS_ID'];?></a></li>
- <?php } ?>
- </form>
- <br>
- <div id="txtHint">Customer info will be listed here...</div> </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement