-
Notifications
You must be signed in to change notification settings - Fork 1
/
addtocart2.php
62 lines (60 loc) · 2.09 KB
/
addtocart2.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
<?php session_start(); include('header.php'); include('conn.php') ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<style>
.cart-header{
width: 25%;
align-self: center;
padding: 5px;
}
</style>
<body>
<?php
$id = $_GET['ProductID'];
$sql = "SELECT ProductName,ProductPrice,ProductQuantity FROM products Where ProductID=$id";
$result = mysqli_query($conn, $sql);
if (!$result) {
exit;
}
if ($result->num_rows == 0) {
return null;
} else {
$rowcount = $result->num_rows;
while ($pdts = $result->fetch_assoc()) {
$total=($pdts['ProductQuantity'])*($pdts['ProductPrice']);
$final=$total+$total;
?>
<div class="container mt-5">
<div class="row" >
<table style="width: 100%;">
<tr class="row bg-primary">
<th class="col-3">#</th>
<th class="col-3">Name</th>
<th class="col-2">Quantity</th>
<th class="col-2">Price per Piece</th>
<th class="col-2">Total</th>
</tr>
<tr class="row" style="background-color: whitesmoke;">
<td class="col-3">#</td>
<td class="col-3"><?php echo $pdts["ProductName"] ?></td>
<td class="col-2"><?php echo $pdts["ProductQuantity"] ?></td>
<td class="col-2"><i class="fas fa-rupee-sign"></i> <?php echo $pdts["ProductPrice"] ?></td>
<td class="col-2"><i class="fas fa-rupee-sign"></i> <?php echo $total; ?></td>
</tr>
<tr class="row" style="background-color: whitesmoke;">
<td class="col-10" align="right">Total:</td>
<td class="col-2"><i class="fas fa-rupee-sign"></i> <?php echo $final; ?></td>
</tr>
</table>
</div>
<?php
}
}
?>
</div>
</body>
</html>