-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcart.php
More file actions
45 lines (42 loc) · 1.33 KB
/
Copy pathcart.php
File metadata and controls
45 lines (42 loc) · 1.33 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
<?php session_start(); ?>
<?php include 'header.php'; ?>
<div class="container">
<table class="table my-3">
<a href="emptycart.php" class="btn btn-sm btn-danger mt-2">Empty Cart</a>
<thead>
<tr class="text-center">
<th>S.no</th>
<th>Product Name</th>
<th>Quantity</th>
<th colspan="2">Action</th>
</tr>
</thead>
<tbody>
<?php
if (isset($_SESSION['cart'])) :
$i = 1;
foreach ($_SESSION['cart'] as $cart) :
?>
<tr class="text-center">
<td><?php echo $i; ?> # </td>
<td> Product <?= $cart['pro_id']; ?></td>
<td>
<form action="update.php" method="post">
<input type="number" value="<?= $cart['qty']; ?>" name="qty" min="1">
<input type="hidden" name="upid" value="<?= $cart['pro_id']; ?>">
</td>
<td>
<input type="submit" name="update" value="Update" class="btn btn-sm btn-warning">
</form>
</td>
<td><a class="btn btn-sm btn-danger" href="removecartitem.php?id=<?= $cart['pro_id']; ?>">Remove</a></td>
</tr>
<?php
$i++;
endforeach;
endif;
?>
</tbody>
</table>
</div>
<?php include 'footer.php'; ?>