-
Notifications
You must be signed in to change notification settings - Fork 0
/
cart.php
132 lines (68 loc) · 2.02 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
<h1 style="text-align:center">YOUR CART</h1>
<hr>
<table style="margin-left:auto;margin-right:auto">
<tr>
<th>| Product Name |</th>
<th> Product Price |</th>
</tr>
<?php
session_start();
include_once("connection.php");
/*$resultx = "SELECT * FROM register WHERE username='$_SESSION[user]'";
$resss = mysqli_query($conn,$resultx);
while($row = mysqli_fetch_assoc($resss)){
echo $row['name'];
echo "<br>";
}*/
/*$r = "SELECT * FROM shop WHERE productname='$_SESSION['p'][0]'";
$re = mysqli_query($conn,$r);
while($rows = mysqli_fetch_assoc($re)){
echo $rows;
}*/
$sum = 0;
$j = 0;
$size = sizeof($_SESSION['p']);
$_SESSION['num'] = sizeof($_SESSION['p']);
while($j<$size){
//print_r($_SESSION['p'][$j]);
$kk = $_SESSION['p'][$j];
//echo $kk;
$resultx = "SELECT * FROM shop WHERE productname='$kk'";
$resss = mysqli_query($conn,$resultx);
echo "<br>";
//echo "Product Name";
while($rows = mysqli_fetch_array($resss)){
$sum = $sum + $rows['productprice'];
/* echo "<br>";
echo $rows['productname'];
echo " Rs.";
echo $rows['productprice'];
echo " ";
echo "<br>";
*/
echo '
<tr>
<td> '.$rows['productname'].' </td>
<td> '.$rows['productprice'].' </td>
</tr>
';
}
$j = $j + 1;
}
?>
</table>
<p style="text-align:center">Total :
<?php echo $sum; $_SESSION['total'] = $sum;
?></p>
<br><br>
<p style="text-align:center"><a href="contact.php">Back</a>
<h1 style="text-align:center">Thanks for choosing us!</h1>
<h2 style="text-align:center"><strong> PAY WITH:</strong></h2>
<form method="post" style="text-align:center" action="bills.php">
<input type="radio" name="choice" value="Online"> Online
<input type="radio" name="choice" value="Offline"> Offline
<br>
<br>
<input type="submit" name="bt" placeholder="Checkout">
</form>
<?php if(isset($_POST['bt'])){ $_SESSION['pay'] = $_POST['choice']; } ?>