-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathviewcart.php
267 lines (240 loc) · 8.68 KB
/
viewcart.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Shop | Keep Shopping</title>
<!-- font-awesome cdn link -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css">
<link rel="stylesheet" href="files/style.css">
<link rel="stylesheet" href="files/shoes.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<style>
/* popup for user starts */
.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 3px;
right: 10px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: #06D85F;
}
.content{
text-align: left;
top: 10px;
}
@media screen and (max-width: 700px){
.box{
width: 70%;
}
.popup{
width: 70%;
}
}
/* popup for user ends */
/* logout button starts */
.btn {
background-color: red;
border: none;
border-radius: 10px;
color: white;
font-weight: bold;
padding: 10px 16px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
/* logout button ends */
</style>
</head>
<body>
<div class="header">
<div class="logo">
<a href="#"><img src="img/logo_original.png" alt="myShop website logo"></a>
</div>
<div class="search">
<form action="search">
<input type="text" name="search-bar" id="search-bar" placeholder="Search for products, brands and more">
</form>
</div>
<div class="icons">
<a href="#" class="fa fa-heart"></a>
<a href="viewcart.php" class="fa fa-shopping-cart"></a>
<a href="#popup1" class="fa fa-user"></a>
<div id="popup1" class="overlay">
<div class="popup">
<a class="close" href="#">×</a>
<div class="content">
<?php echo $_SESSION['user_name'] ?>
<a href="logout.php" class="btn">logout</a>
</div>
</div>
</div>
<a href="#" class="fa fa-bars"></a>
</div>
</div>
<div class="links">
<a href="#">Shoes</a>
<div class="row">
<h1 class="text-center border-bottom pb-4 mb-4">View Cart Products</h1>
<?php
if(isset($_GET['value']) == "updated"){
?>
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<strong>Successfully!</strong> Your product updated.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<?php
}else if(isset($_GET['value']) == "deleted"){
?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<strong>Successfully!</strong> Your product deleted.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<?php
}
?>
</div>
<div class="row">
<table class="table">
<thead>
<tr>
<td>Sno</td>
<td>Name</td>
<td>Price</td>
<td>Quantity</td>
<td>Total</td>
<td>Update</td>
<td>Delete</td>
</tr>
</thead>
<tbody>
<?php
$sno = 1;
$t = 0;
foreach($_SESSION as $product){
$p = 0;
$q = 0;
echo "<form action='editCart.php' method='POST'>";
echo "<tr>";
echo "<td>".$sno++."</td>";
foreach($product as $key => $value){
if($key == 0){
echo "<td>".$value."</td>";
echo "<input type='hidden' name='pro$key' value='".$value."'>";
}else if($key == 1){
echo "<td>".$value."</td>";
echo "<input type='hidden' name='pro$key' value='".$value."'>";
$p = $value;
}else if($key == 2){
echo "<td><input type='text' name='pro$key' value='".$value."' class='form-control'></td>";
$q = $value;
}
}
$t = $p * $q;
echo "<td>".$t."</td>";
echo "<td><input type='submit' name='event' value='Update' class='btn btn-warning'></td>";
echo "<td><input type='submit' name='event' value='Delete' class='btn btn-danger'></td>";
echo "</tr>";
echo "</form>";
}
?>
</tbody>
</table>
</div>
</div>
<!-- footer starts -->
<footer class="footer">
<div class="footer_container">
<div class="row">
<div class="footer-col">
<h4>Company</h4>
<ul>
<li><a href="#">about us</a></li>
<li><a href="#">our services</a></li>
<li><a href="#">privacy policy</a></li>
<li><a href="#">affiliate program</a></li>
</ul>
</div>
<div class="footer-col">
<h4>Get Help</h4>
<ul>
<li><a href="#">FAQ</a></li>
<li><a href="#">shipping</a></li>
<li><a href="#">returns</a></li>
<li><a href="#">order status</a></li>
<li><a href="#">payment options</a></li>
</ul>
</div>
<div class="footer-col">
<h4>Online shop</h4>
<ul>
<li><a href="#">Watches</a></li>
<li><a href="#">Bag</a></li>
<li><a href="#">Shoes</a></li>
<li><a href="#">Dress</a></li>
</ul>
</div>
<div class="footer-col">
<h4>follow us</h4>
<div class="social-links">
<a href="#"><i class="fab fa-facebook-f"></i></a>
<a href="#"><i class="fab fa-twitter"></i></a>
<a href="#"><i class="fab fa-instagram"></i></a>
<a href="#"><i class="fa-brands fa-linkedin-in"></i></a>
</div>
</div>
</div>
</div>
</footer>
<!-- footer ends -->
<!-- Javascript -->
<script src="files/script.js"></script>
</body>
</html>