-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart.php
102 lines (79 loc) · 3.37 KB
/
cart.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
<?php
require 'includes/common.php';
if(!isset($_SESSION['email'])){
echo "Only Logged in users can access this page.Please ";
?><a href="login.php" class="btn btn-primary">Login</a><?php
die();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>LIFESTYLE STORE|CART</title>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<script src="bootstrap/js/jquery-3.2.1.min.js" type="text/javascript"></script>
<script src="bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<?php
include 'includes/header.php';
$id=$_SESSION['id'];
?>
<div class="container">
<table class="table table-striped table-bordered table-hover table-responsive" >
<tbody>
<tr><th>Item Number</th>
<th>Item Name</th>
<th>Price</th>
<th></th></tr>
<?php
$select_query="SELECT i.name,i.price,i.id FROM items i INNER JOIN users_items u ON i.id=u.item_id WHERE u.user_id=$id";
$result= mysqli_query($con, $select_query);
$total_rows= mysqli_num_rows($result);
if($total_rows==0)
{
echo "NO ITEMS IN THE CART! ADD ITEMS FIRST!";
}
else {
$sum=0;
for($counter=1;$counter<=$total_rows;$counter++)
{
$row= mysqli_fetch_array($result);
$sum=$sum+$row['price'];
$itmid=$row['id'];
if($counter==1)
$ar="$itmid";
else {
$ar.="|"."$itmid";
}
?><tr><td> <?php echo $counter ?> </td>
<td><?php echo $row['name'];?></td>
<td><?php echo $row['price'];?></td>
<td> <?php echo '<a href="cart_remove.php?id=' . $itmid . '" class="btn btn-block btn-primary">Remove from cart</a>';?></td></tr>
<?php
}
}
?> <tr>
<td></td>
<td>Total</td>
<td><?php echo "Rs."." ". $sum."/-"; ?></td>
<td><center><?php
echo '<a href="success.php?id=' . $ar . '" class="btn btn-primary">Confirm Order</a>';?> </center></td>
</tr> <?php
?>
</tbody>
</table>
</div>
<footer id="footer1">
<div class="container">
<center>
Copyright © Lifestyle Store. All Rights
Reserved | Contact Us: +91 90000 00000
</center>
</div>
</footer>
</body>
</html>