-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsupplierInventoryOption.php
32 lines (26 loc) · 1.05 KB
/
supplierInventoryOption.php
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
<!-- AJAX handling php file to receive the response from the request in the helper.js
file which is triggered by the the onclick function in the createOrder.php file when
the user clicks on the SUPPLIER select element to display suppliers inventory inside items <select> element -->
<?php
require_once ("../../mysqli_Coffee_config.php"); // Connect to the database
$value = $_GET['value'];
$query = "SELECT Item.itemName
FROM Item INNER JOIN Supplier ON Item.supplierID = Supplier.supplierID
WHERE supplierName = '$value'
ORDER BY ItemName";
$result = mysqli_query($dbc, $query);
if ($result){
$all_rows = mysqli_fetch_all($result, MYSQLI_ASSOC);
}
else{
exit;
}
echo("<option id=\"first\" value=\"\">SELECT ITEM</option>");
foreach($all_rows as $items){
echo("<option");
echo(" class=\"item\">".$items['itemName']."</option>");
echo("<input type=\"number\">");
}
mysqli_free_result($result);
mysqli_close($dbc);
?>