1+ <?php
2+ // connecting to database
3+ $ servername = "localhost " ;
4+ $ username = "root " ;
5+ $ password = "" ;
6+ $ database = "charliestore " ;
7+
8+ // create a connection
9+ $ con = mysqli_connect ($ servername , $ username , $ password , $ database );
10+
11+ ?>
12+
13+ <!doctype html>
14+ <html lang="en">
15+ <head>
16+ <!-- Required meta tags -->
17+ <meta charset="utf-8">
18+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
19+
20+ <!-- Bootstrap CSS -->
21+ <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
22+
23+ <!-- Font awesome link -->
24+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
25+
26+ <title>Products</title>
27+ </head>
28+ <body>
29+
30+
31+
32+ <div class="container">
33+ <div class="row justify-content-center">
34+ <div class="col-lg-11">
35+ <div class="table responsive mt-2">
36+ <table class="table table-bordered table-striped text-center">
37+ <thead>
38+ <tr>
39+ <td colspan="7">
40+ <h3 text-center> Your Products!</h3>
41+ </td>
42+ </tr>
43+ <tr>
44+ <th>Name</th>
45+ <th>Image</th>
46+ <th>Quantity</th>
47+ <th>Price</th>
48+ <th>Tax</th>
49+ <th>GST</th>
50+ <!-- get request -->
51+ <th><a onclick="return confirm('Are you sure you want to clear your cart? ')" href="action.php?clear=all" class="badge badge-danger"><i class="fa fa-trash"></i> Clear cart</a></th></tr>
52+ </thead>
53+ <tbody>
54+
55+ <?php
56+ // $id = $_GET['productid'];
57+ $ query = "SELECT * FROM `products` " ;
58+ $ result = mysqli_query ($ con , $ query );
59+ // $result->num_rows>0
60+ $ total =0 ;
61+ while ($ row = mysqli_fetch_assoc ($ result )):
62+
63+ $ productname = $ row ["productname " ];
64+ $ priceperunit = number_format ($ row ["priceperunit " ],2 );
65+ $ manufacturingdate = $ row ["manufacturingdate " ];
66+ $ inventoryquantity = $ row ["inventoryquantity " ];
67+ $ productimage = $ row ["productimage " ];
68+ $ id = $ row ["productid " ];
69+
70+ ?>
71+ <tr>
72+ <td><input type="text" class="form-control text-center" value="<?php echo $ productname ?> "></td>
73+ <td><input type="text" class="form-control text-center" width="50" value="<?php echo $ productimage ?> "></td>
74+ <td><input type="number" class="form-control text-center" min="1" value="<?php echo $ inventoryquantity ?> "></td>
75+ <td><input type="text" class="form-control text-center" value="<?php echo $ priceperunit ?> " disabled></td>
76+ <td><input type="text" class="form-control" id="gst" disabled></td>
77+ <td><input type="text" class="form-control" id="total" name="total" disabled></td>
78+ <td><a href="action.php?delete=<?php $ id?> " class="text-danger"><i class="fa fa-trash"></i> </a></td>
79+
80+ <?php endwhile ;?>
81+
82+
83+ <tr><td colspan="3"><a href="product.php" class="btn btn-success"><i class="fa fa-cart-plus"></i> Continue Shopping</a></td>
84+ <td colspan="2" class="mt-2">Amount to be paid</td>
85+ <td><i class="fa fa-rupee"></i> <?php echo number_format ($ total ,2 )?> </td>
86+ <!-- go for payment -->
87+ <td><a href="" class="btn btn-info"><i class="fa fa-credit-card"></i>Pay</a></td>
88+ </tr>
89+ </tr>
90+ </tbody>
91+ </table>
92+ </div>
93+ </div>
94+ </div>
95+ </div>
96+
97+
98+ <!-- Optional JavaScript -->
99+ <!-- jQuery first, then Popper.js, then Bootstrap JS -->
100+ <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
101+ <script src="https://cdn.jsdelivr.net/npm/
[email protected] /dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
102+ <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
103+ </body>
104+ </html>
0 commit comments