Advertisement
Guest User

Untitled

a guest
Jun 14th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. <script src="jquery-1.10.2.js"></script>
  2. <script src="jquery-ui.js"></script>
  3. <script>
  4. $(function() {
  5. $( "#color" ).autocomplete({
  6. source: 'search.php'
  7. });
  8. });
  9. </script>
  10. <script>
  11. $(function() {
  12. $( "#size" ).autocomplete({
  13. source: 'search1.php'
  14. });
  15. });
  16. </script>
  17. </head>
  18.  
  19. <body>
  20. <div class="col-md-12">
  21. <div class="row">
  22. <div class="ui-widget">
  23. <label for="color">Item Color: </label>
  24. <input id="color" name="color" type="text">
  25. </div>
  26.  
  27. <div class="ui-widget">
  28. <label for="size">Item Size: </label>
  29. <input id="size"name="size" type="text">
  30. </div>
  31.  
  32. <div><input type="text" name="cost_price" /></div>
  33. <div><input type="text" name="selling_price" /></div>
  34. </div>
  35. </div>
  36.  
  37. <?php
  38. //database configuration
  39. $dbHost = 'localhost';
  40. $dbUsername = 'xxxx';
  41. $dbPassword = 'xxxx';
  42. $dbName = 'xxxx';
  43.  
  44.  
  45. $db = new mysqli($dbHost,$dbUsername,$dbPassword,$dbName);
  46.  
  47.  
  48. $searchTerm = $_GET['term'];
  49.  
  50.  
  51. $query = $db->query("SELECT * FROM leads WHERE company LIKE '".$searchTerm."%' ORDER BY company ASC");
  52. while ($row = $query->fetch_assoc()) {
  53. $data[] = $row['company'];
  54. }
  55.  
  56.  
  57. echo json_encode($data);
  58. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement