-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomers_autocomplete_Ajax.php
More file actions
58 lines (33 loc) · 1.19 KB
/
Customers_autocomplete_Ajax.php
File metadata and controls
58 lines (33 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
//Including Database configuration file.
include('dbconnect.php');
//Getting value of "inlineFormInputGroup" variable from "script.js".
if (isset($_POST['customer'])) {
//call dbconn
$conn = dbConn();
//inlineFormInputGroup box value assigning to $Name variable.
$Name = $_POST['customer'];
//inlineFormInputGroup query.
$Query = "SELECT * FROM view_allcustomers WHERE Name LIKE '%$Name%' LIMIT 10";
//Query execution
$ExecQuery = MySQLi_query($conn, $Query);
//Creating unordered list to display result.
?>
<ul class="list-unstyled text-left text-info">
<?php
//Fetching result from database.
while ($Result = MySQLi_fetch_array($ExecQuery)) {
?>
<!-- Creating unordered list items.
Calling javascript function named as "fill" found in "script.js" file.
By passing fetched result as parameter. -->
<li id=<?php echo $Result[0]; ?> onclick='fill("<?php echo $Result[1];?>","<?php echo $Result[0]; ?>")'>
<a class="list-group-item">
<!-- Assigning inlineFormInputGrouped result in "inlineFormInputGroup box" in "inlineFormInputGroup.php" file. -->
<?php echo $Result[1]; ?>
</li></a>
<!-- Below php code is just for closing parenthesis. Don't be confused. -->
<?php
}}
?>
</ul>