-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_order.php
128 lines (128 loc) · 5.8 KB
/
user_order.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
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
<?php
////This page is responsible for showing the history of the user's orders
session_start();
include 'connection.php';
$link = connect();
$user = $_SESSION['user_ID'];
if($_SESSION['name'] == ""){
header('location:index.php');
}
?>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link href="https://fonts.googleapis.com/css?family=Rajdhani" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Anton" rel="stylesheet">
<link rel="stylesheet" type = "text/css" href = "user_order.css">
</head>
<body>
<nav class = "navbar navbar-inverse">
<div class = "container-fluid">
<div class = "navbar-header">
<button type = "button" class = "navbar-toggle" data-toggle = "collapse"
data-target = "#myNavbar">
<span class = "icon-bar"></span>
<span class = "icon-bar"></span>
<span class = "icon-bar"></span>
</button>
<a class = "navbar-brand" href = "home.php">Home</a>
</div>
<div class = "collapse navbar-collapse" id = "myNavbar">
<ul class = "nav navbar-nav">
<li class = "dropdown">
<a class = "dropdown-toggle" data-toggle="dropdown"
href = "#">Headphones<span class = "caret" ></span></a>
<ul class = "dropdown-menu">
<li><a href = "beats.php">Beats</a></li>
<li><a href = "sony.php">Sony</a></li>
<li><a href = "skullcandy.php">skullCandy</a></li>
<li><a href = "bose.php">Bose</a></li>
</ul>
</li>
<li class = "dropdown">
<a class = "dropdown-toggle" data-toggle="dropdown"
href = "#">Earphones<span class = "caret"></span></a>
<ul class = "dropdown-menu">
<li><a href = "beatsEarphone.php">Beats</a></li>
<li><a href = "sonyEarphone.php">Sony</a></li>
<li><a href = "skullcandyEarphone.php">skullCandy</a></li>
<li><a href = "boseEarphone.php">Bose</a></li>
</ul>
</li>
<li><a href = "speaker.php">Speakers</a></li>
<li><a href = "accessories.php">Accessories</a></li>
<li><a href = "contact.php">Contact Us</a></li>
</ul>
<form class = "navbar-form navbar-left" method = "post" action = "search.php">
<div class = "form-group">
<input class = "form-control" type = "text" name = "search" placeholder="Search">
</div>
<button type = "submit" class = "btn btn-default" name="search_btn"><span class = "glyphicon glyphicon-search"></span></button>
</form>
<ul class = "nav navbar-nav navbar-right">
<li class = "dropdown">
<a class = "dropdown-toggle" data-toggle="dropdown" href = "#"><span class = "glyphicon glyphicon-user"></span><?php echo $_SESSION['name']; ?>
</a>
<ul class = "dropdown-menu">
<li><a href = "checkout.php">ShoppingCart</a></li>
<li><a href = "user_order.php">Orders</a></li>
<li><a href = "index.php">Logout</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div class = "row">
<div class = "col-lg-2"></div>
<div class = "col-lg-8">
<div class = "row">
<div class = "box">
<h1>
<?php echo $_SESSION['name']; ?>'s Orders
<table class = "table table-dark">
<thead>
<th>Item</th>
<th>Quantity</th>
<th>Paid</th>
<th>Status</th>
</thead>
<?php
$sql = "SELECT * FROM orders WHERE userID = '$user'";
$result = mysqli_query($link, $sql);
while($row = mysqli_fetch_assoc($result)){
$status = $row['sendOrder'];
$name = $row['name'];
$quantity = $row['quantity'];
$paid = $row['paid'];
?>
<tr>
<td><?php echo $name ?></td>
<td><?php echo $quantity ?></td>
<td><?php echo $paid ?></td>
<?php
if($status == 1){
echo "<td style = 'color:green;'>Item Has been Sent</td>";
}
else{
echo "<td style = 'color:red;'>Not sent yet</td>";
}
?>
</tr>
<?php
}
?>
</table>
</h1>
</div>
</div>
</div>
</div>
</body>
</html>