-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patht.php
154 lines (134 loc) · 3.47 KB
/
t.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
<?php
// Start the session
session_set_cookie_params(3600,"/");
session_start();
if(!isset($_SESSION['email_id'])){
header("location: login.php");
}?>
<style>
table{
width: 70%;
border-collapse: collapse;
}
table
td {
padding: 15px;
border-bottom: 1px solid #ddd;
}
table
th {
height: 50px;
padding: 15px;
border-bottom: 1px solid #ddd;
}
tr:hover{background-color:#f5f5f5;}
tr:nth-child(even) {background-color: #f2f2f2}
</style>
<!-- start-smoth-scrolling -->
</head>
<body>
<!-- header -->
<?php include 'head.php' ?>
<H1 align="center"> Cart </H1>
<div id="box1" >
<table align="center">
<thead>
<tr>
<th> S.no. </th>
<th> Product Name </th>
<th> Product ID </th>
<th> Quantity</th>
<th> Subtotal</th>
<th> Decrease </th>
<th> Increase </th>
<th> Remove </th>
</tr>
</thead>
<tbody>
<?php
/*
if(!isset($_SESSION['email_id'])){
echo "LLAL";
if(isset($_SESSION['lastloc'])){
header("Location: " . $_SESSION["lastloc"]);
}
else{
echo "ce";
header("location: index.php");
}
}*/
$db = mysqli_connect("localhost",'root','121');
$query = "use carts";
mysqli_query($db, $query);
if(!isset($_SESSION['unique'])) header("location: login.php");
else $cartname = $_SESSION['unique'];
//echo $cartname;
$query = "SELECT * from $cartname";
$res = mysqli_query($db, $query);
$cnt = 0;
$query = "use fdx";
$mainTotal = 0;
mysqli_query($db, $query);
if(mysqli_num_rows($res)==0){
echo '<tr><td colspan="10">No Rows Returned</td></tr>';
} else {
while($row = mysqli_fetch_assoc($res)){
// $pname = $row['product_name'];
$pid = $row['product_id'];
$pq = $row['quantity'];
$query = "SELECT * from products where products.product_id = $pid";
$arr = mysqli_fetch_array(mysqli_query($db, $query));
echo "<h1>".arr[3]."</h1>";
$subt = $arr[3] * $pq;
$nam = $cartname;
$mainTotal += $subt;
$cnt += 1;
echo "<tr><td>{$cnt}</td><td>{$row['product_name']}</td> <td>{$row['product_id']}</td> <td>{$row['quantity']}</td>
<td>{$subt}</td>
<td><a href = redQuantity.php?productid=$pid&cartname=$nam&type=1> Q-- </a></td>
<td><a href = redQuantity.php?productid=$pid&cartname=$nam&type=2> Q++ </a></td>
<td><a href = delete.php?productid=$pid&cartname=$nam> remove </a></td></tr>
";
}
}
?>
</tbody></table>
</div>
<?php
echo "<h3 align = 'center'> Your total is: Rs. ".$mainTotal."</h3></br>";
echo "<h3 align = 'center'><a href='OrderSummary.php?cartname=$cartname'>PlaceOrder</a></h3></br></br>";
?>
<?php include 'footer.php' ; ?>
<!-- //footer -->
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<script>
$(document).ready(function(){
$(".dropdown").hover(
function() {
$('.dropdown-menu', this).stop( true, true ).slideDown("fast");
$(this).toggleClass('open');
},
function() {
$('.dropdown-menu', this).stop( true, true ).slideUp("fast");
$(this).toggleClass('open');
}
);
});
</script>
<!-- here stars scrolling icon -->
<script type="text/javascript">
$(document).ready(function() {
/*
var defaults = {
containerID: 'toTop', // fading element id
containerHoverID: 'toTopHover', // fading element hover id
scrollSpeed: 1200,
easingType: 'linear'
};
*/
$().UItoTop({ easingType: 'easeOutQuart' });
});
</script>
</body>
</html>