-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomerOrder.php
More file actions
132 lines (125 loc) · 4.16 KB
/
CustomerOrder.php
File metadata and controls
132 lines (125 loc) · 4.16 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
window.onload = function(){
$("#add") .hide();
$("#delete").hide();
$("#update").hide();
}
$(document).ready(function(){
$("#showAdd").click(function(){
$("#add").show();
$("#delete").hide();
$("#update").hide();
});
$("#showDelete").click(function(){
$("#add").hide();
$("#delete").show();
$("#update").hide();
});
$("#showUpdate").click(function(){
$("#add").hide();
$("#delete").hide();
$("#update").show();
});
});
</script>
</head>
<header>
<h3><a href="index.php">Back</a><h3>
</header>
<body>
<form action="CustomerOrder.php" method="post">
<input type="search" name="search" placeholder="Search..">
</form>
<?php
include "db.php";
// Create connection
//$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
//if ($conn->connect_error) {
// die("Connection failed: " . $conn->connect_error);
//}
$order = isset($_GET['sort'])?$_GET['sort']:'orderID';
error_reporting(0);
$id = $_POST["search"];
if($id==null)
{
$sql = "SELECT orderID, orderQuantity, deliveryTime, orderDate, ProductID, customerID FROM customerorder ORDER BY $order";
}
else
{
$sql = "SELECT orderID, orderQuantity, deliveryTime, orderDate, ProductID, customerID FROM customerorder WHERE orderID='$id' or orderQuantity='$id' or deliveryTime='$id' or deliveryDate='$id' or ProductID='$id' or customerID='$id' ORDER BY $order";
}
$result = mysql_query($sql, $db);
echo "<table width = '100%' class='demo'>
<caption><h2>Product</h2></caption>
<tr>
<th><a href='CustomerOrder.php?sort=orderID'>ID</a></th>
<th><a href='CustomerOrder.php?sort=orderQuantity'>Quantity</a></th>
<th><a href='CustomerOrder.php?sort=deliveryTime'>Delivery Time</a></th>
<th><a href='CustomerOrder.php?sort=orderDate'>Order Date</a></th>
<th><a href='CustomerOrder.php?sort=ProductID'>Product ID</a></th>
<th><a href='CustomerOrder.php?sort=customerID'>Customer ID</a></th>
</tr>";
while($row = mysql_fetch_array($result)) {
echo "<tr> <td>" . $row["orderID"] . "</td> <td>" . $row["orderQuantity"] . "</td> <td>" . $row["deliveryTime"] . "</td> <td>" .
$row["orderDate"] . "</td> <td>" . $row["ProductID"] . "</td> <td>" . $row["customerID"];
echo "</td></tr>";
// echo "<a href = 'index.php/". $row["staffID"] ."'>" . "id: " . $row["staffID"]. " - Name: " . $row["sFname"]. " " . $row["sSurname"]. "<br>" . "</a>";
}
echo " </table>"
?>
<br>
<br>
<table width="100%">
<tr>
<td width = "33.3%" align="center"><button id="showAdd">Add Order</button></td>
<td width = "33.3%" align="center"><button id="showDelete">Delete Order</button></td>
<td width = "33.3%" align="center"><button id="showUpdate">Update Order</button></td>
</tr>
<tr >
<td width = "33.3%" align="center">
<form name="Add Customer Order" action="AddCustomerOrderForm.php" method="post" id = "add" class="center">
<div class="field">
<label>Quantity</label>
<input type="text" name="quantity"><br>
<label>Product ID</label>
<input type="text" name="productid"><br>
<label>Customer ID</label>
<input type="text" name="customerid"><br>
<input type="submit" value="Submit">
</div>
</form>
</td>
<td width = "33.3%" align="center">
<form name="Delete Product" action="DeleteCustomerOrderForm.php" method="post" id = "delete" class="center">
<div class="field">
<label>ID (Unique)</label>
<input type="text" name="id"><br>
<input type="submit" value="Submit">
</div>
</form>
<td width = "33.3%" align="center">
<form name="Update Product" action="UpdateCustomerOrderForm.php" method="post" id = "update" class="center">
<div class="field">
<label>ID (Unique)</label>
<input type="text" name="id"><br>
<label>Quantity</label>
<input type="text" name="quantity"><br>
<label>Delivery Time</label>
<input type="text" name="producttype"><br>
<input type="submit" value="Submit">
<label>Product ID</label>
<input type="text" name="productid"><br>
<label>Customer ID</label>
<input type="text" name="customerid"><br>
</div>
</form>
</td>
</tr>
</table>
</body>
</html>