-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart.php
191 lines (169 loc) · 6.04 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
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
<?php require "connect.php"; session_start();
?>
<html>
<head>
<link rel="stylesheet" href="css\bootstrap.min.css" >
<!--jQuery library-->
<script src="js/jquery.min.js"></script>
<!--Latest compiled and minified JavaScript-->
<script src="js\bootstrap.min.js"></script>
<link rel="stylesheet" href="css/bindex.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Product FreeStyle Store</title>
</head>
<body>
<?php
include 'header.php';
$price=0;
$_SESSION['price']=$price;
?>
<!---nav class="navbar navbar-inverse navbar-fixed-top navbar-responsive">
<div class="container">
<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="product.php">Lifestyle Store</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<li><a href="cart.php"><span class="glyphicon glyphicon-user"></span> Cart</a></li>
<li><a href="setting.php"><span class="glyphicon glyphicon-user"></span>Setting</a></li>
<li><a href="bindex.php"><span class="glyphicon glyphicon-log-out"></span>Logout</a></li>
</ul>
</div>
</div>
</nav>--->
<div class="container">
<div class="table-responsive">
<table class="table table-striped table-hover table-responsive" style=" margin-top:10%; margin-left:25%; max-width:50%;">
<tbody>
<tr><th>Item Number </th> <th>ItemName </th> <th>Price </th><th> </th></tr>
<tr><td><br>
<?php
$email=$_SESSION['email'];
//echo $email;
$select_query="select item_id from users_items ui inner join users u on ui.user_id=u.id where u.email='$email'";
$select_query_result= mysqli_query($con,$select_query) or die(mysqli_error($con));
if(mysqli_num_rows($select_query_result) == 0)
{
?><h1><a href="product.php"><?php echo 'First Add to Cart!';?></h1></a>
<?php
}
else{
while($check_email= mysqli_fetch_array($select_query_result))
{
echo $check_email['item_id'];
?><br><br><?php
}}?>
</td>
<td>
<br>
<?php
$select_query="select i.name,i.price,i.pid from items i inner join users_items ui on i.pid=ui.item_id
inner join users u on u.id=ui.user_id where u.email='$email'";
$select_query_result= mysqli_query($con,$select_query) or die(mysqli_error($con));
while($check_email= mysqli_fetch_array($select_query_result))
{
echo $check_email['name'];
?><br><br><?php
}?>
</td>
<td>
<br>
<?php
$select_query="select i.name,i.price from items i inner join users_items ui on i.pid=ui.item_id
inner join users u on u.id=ui.user_id where u.email='$email'";
$select_query_result= mysqli_query($con,$select_query) or die(mysqli_error($con));
while($check_email= mysqli_fetch_array($select_query_result))
{
echo $price1=$check_email['price'];
$price=$price+$price1;
$_SESSION['price']=$price;
?><br><br><?php
}?>
</td>
<td>
<?php
$email=$_SESSION['email'];
//echo $email;
$select_query="select item_id from users_items ui inner join users u on ui.user_id=u.id where u.email='$email'";
$select_query_result= mysqli_query($con,$select_query) or die(mysqli_error($con));
if(mysqli_num_rows($select_query_result) == 0)
{
}
else
{
while($row= mysqli_fetch_array($select_query_result))
{
//$var=$check_email['item_id'];
if($row['item_id']==1)
{
?><br><a href='cart-remove.php?id=1' class='remove_item_link'> Remove</a><br><?php
}
if($row['item_id']==2)
{
?><br><a href='cart-remove.php?id=2' class='remove_item_link'> Remove</a><br><?php
}
if($row['item_id']==3)
{
?><br><a href='cart-remove.php?id=3' class='remove_item_link'> Remove</a><br><?php
}
if($row['item_id']==4)
{
?><br><a href='cart-remove.php?id=4' class='remove_item_link'> Remove</a><br><?php
}
if($row['item_id']==5)
{
?><br><a href='cart-remove.php?id=5' class='remove_item_link'> Remove</a><br><?php
}
if($row['item_id']==6)
{
?><br><a href='cart-remove.php?id=6' class='remove_item_link'> Remove</a><br><?php
}
if($row['item_id']==7)
{
?><br><a href='cart-remove.php?id=7' class='remove_item_link'> Remove</a><br><?php
}
if($row['item_id']==8)
{
?><br><a href='cart-remove.php?id=8' class='remove_item_link'> Remove</a><br><?php
}
}
}?>
</td>
</tr>
<tr>
<td></td>
<td>Total</td><td>₹ <?php echo $_SESSION['price'] ?></td>
<td>
<?php
if($_SESSION['price']==0)
{
echo '<a href="#" class="btn btn-block btn-danger" disabled>Confirm Order</a>';
}
else
{
?>
<button type="button" class="btn btn-primary" name="confirm" ><a href="success.php" style="color:white;">Confirm Order</a></button>
<?php
}
?>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="footer" style="margin-top:25.5%;">
<div class="container">
<center>
Copyright © <a href="bindex.php">Lifestyle Store.</a> All Rights
Reserved” and “Contact Us: +91 90000 00000"
</center>
</div>
</div>
</body>
</html>