Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="jquery-1.10.2.js"></script>
- <script src="jquery-ui.js"></script>
- <script>
- $(function() {
- $( "#color" ).autocomplete({
- source: 'search.php'
- });
- });
- </script>
- <script>
- $(function() {
- $( "#size" ).autocomplete({
- source: 'search1.php'
- });
- });
- </script>
- </head>
- <body>
- <div class="col-md-12">
- <div class="row">
- <div class="ui-widget">
- <label for="color">Item Color: </label>
- <input id="color" name="color" type="text">
- </div>
- <div class="ui-widget">
- <label for="size">Item Size: </label>
- <input id="size"name="size" type="text">
- </div>
- <div><input type="text" name="cost_price" /></div>
- <div><input type="text" name="selling_price" /></div>
- </div>
- </div>
- <?php
- //database configuration
- $dbHost = 'localhost';
- $dbUsername = 'xxxx';
- $dbPassword = 'xxxx';
- $dbName = 'xxxx';
- $db = new mysqli($dbHost,$dbUsername,$dbPassword,$dbName);
- $searchTerm = $_GET['term'];
- $query = $db->query("SELECT * FROM leads WHERE company LIKE '".$searchTerm."%' ORDER BY company ASC");
- while ($row = $query->fetch_assoc()) {
- $data[] = $row['company'];
- }
- echo json_encode($data);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement