-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshoppingcart.php
73 lines (72 loc) · 2.62 KB
/
shoppingcart.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
<?php
include("header.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<title>Cart</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-12 text-center border rounded bg-light my-5">
<h1>MY CART</h1>
</div>
<div class="col-lg-9">
<table class="table">
<thead class="text-center">
<tr>
<th scope="col">Serial No.</th>
<th scope="col">Item Name</th>
<th scope="col">Item Price</th>
<th scope="col">Quantity</th>
<th scope="col"></th>
</tr>
</thead>
<tbody class="text-center">
<?php
$total=0;
if(isset($_SESSION['cart']))
{
foreach($_SESSION['cart'] as $key => $value)
{
$sr=$key+1;
$total=$total+$value['Price'];
echo
"
<tr>
<td>$sr</td>
<td>$value[Item_Name]</td>
<td>$value[Price]</td>
<td><input class='text-center' type='number' value='$value[Quantity]' min='1' max='10'></td>
<td>
<form action='manage_cart.php' method='POST'>
<button name='Remove_Item' class= 'btn btn-sm btn-outline-danger'>REMOVE</button>
<input type='hidden' name='Item_Name' value='$value[Item_Name]'>
</form>
</td>
</tr>
";
}
}
?>
</tbody>
</table>
</div>
<div class="col-lg-3">
<div class="border bg-light rounded p-4">
<h4>Total:</h4>
<h5 class="text-right"><?php echo $total ?></h5>
<br>
<form>
<button class="btn btn-primary btn-block">Make Purchase </button>
</form>
</div>
</div>
</div>
</div>
</body>
</html>