Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Order</title>
- <meta charset="utf-8">
- <link rel="stylesheet" href="css/common.css" type="text/css">
- <script src="Script/MyScript.js"></script>
- </head>
- <body onload="pload()">
- <?php
- include 'nav.html';
- include 'conn.php';
- //read user inputs feom login form
- $name=$_POST["name"];
- echo "<h1>Welcome $name</h1>";
- $password=$_POST["password"];
- //declare database variables
- $dbServer="localhost:3307";
- $dbUser="root";
- $dbPassword="";
- $dbName="NSDB2019";
- //create connection
- $conn= new mysqli($dbServer, $dbUser, $dbPassword, $dbName);
- //check connection successful
- if($conn->connect_error==true){
- die ("connection failed".$conn->connect_error);
- }else{
- echo "<h2>Connection Successful</h2>";
- }
- $custid=$_POST['id'];
- $name=$_POST['name'];
- //display welcome message
- echo"<h1>See Your Past Orders</h1>";
- //create sql statement
- $sql="SELECT * FROM ORDERS WHERE CustID=".$custid."";
- $result = $conn->query($sql);
- echo "<form method=post action=shopping.php>";
- if($result->num_rows<=0){
- echo "<p class='fail'>Welcome ".$name." you have not ordered yet </p>";
- }else{
- //create form for submission
- //create table for product
- echo "<table border=1 color:darkblue>";
- echo "<th> Order ID <th> Date <th> Pep Qty <th> Ske Qty <th> App QTY <th> Order Total <th> Card Name</th>";
- while($row=$result->fetch_assoc()){
- echo"<tr><td>".$row["OrderID"]."</td>";
- echo"<td>".$row["Date"]."</td>";
- echo"<td>".$row["PepQty"]."</td>";
- echo"<td>".$row["SkeQty"]."</td>";
- echo"<td>".$row["AppQty"]."</td>";
- echo"<td>".$row["Total"]."</td>";
- echo"<td>".$row["CardName"]."</td>";
- }
- }
- echo"</table>";
- //close db connection
- $conn->close();
- echo"<h2>May I Take Your Order </h2>";
- echo"<input type=hidden name=id value=".$custid.">";
- echo"<input type=hidden name=name value=".$name.">";
- echo"<h2><input type=submit formaction=shopping.php class=goshopping value='Go Shopping'></h2>";
- echo"</form>";
- ?>
- <footer>
- <p>Copyright © 2019 - All Rights Reserved</p>
- <p>Nisha Shrestha</p>
- </footer>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement