Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Order</title>
  5. <meta charset="utf-8">
  6. <link rel="stylesheet" href="css/common.css" type="text/css">
  7. <script src="Script/MyScript.js"></script>
  8. </head>
  9. <body onload="pload()">
  10. <?php
  11. include 'nav.html';
  12. include 'conn.php';
  13. //read user inputs feom login form
  14. $name=$_POST["name"];
  15. echo "<h1>Welcome $name</h1>";
  16. $password=$_POST["password"];
  17. //declare database variables
  18. $dbServer="localhost:3307";
  19. $dbUser="root";
  20. $dbPassword="";
  21. $dbName="NSDB2019";
  22. //create connection
  23. $conn= new mysqli($dbServer, $dbUser, $dbPassword, $dbName);
  24. //check connection successful
  25. if($conn->connect_error==true){
  26. die ("connection failed".$conn->connect_error);
  27. }else{
  28. echo "<h2>Connection Successful</h2>";
  29. }
  30. $custid=$_POST['id'];
  31. $name=$_POST['name'];
  32. //display welcome message
  33. echo"<h1>See Your Past Orders</h1>";
  34. //create sql statement
  35. $sql="SELECT * FROM ORDERS WHERE CustID=".$custid."";
  36. $result = $conn->query($sql);
  37. echo "<form method=post action=shopping.php>";
  38. if($result->num_rows<=0){
  39. echo "<p class='fail'>Welcome ".$name." you have not ordered yet </p>";
  40. }else{
  41. //create form for submission
  42.  
  43. //create table for product
  44. echo "<table border=1 color:darkblue>";
  45. echo "<th> Order ID <th> Date <th> Pep Qty <th> Ske Qty <th> App QTY <th> Order Total <th> Card Name</th>";
  46. while($row=$result->fetch_assoc()){
  47. echo"<tr><td>".$row["OrderID"]."</td>";
  48. echo"<td>".$row["Date"]."</td>";
  49. echo"<td>".$row["PepQty"]."</td>";
  50. echo"<td>".$row["SkeQty"]."</td>";
  51. echo"<td>".$row["AppQty"]."</td>";
  52. echo"<td>".$row["Total"]."</td>";
  53. echo"<td>".$row["CardName"]."</td>";
  54.  
  55. }
  56. }
  57. echo"</table>";
  58. //close db connection
  59. $conn->close();
  60.  
  61. echo"<h2>May I Take Your Order </h2>";
  62. echo"<input type=hidden name=id value=".$custid.">";
  63. echo"<input type=hidden name=name value=".$name.">";
  64. echo"<h2><input type=submit formaction=shopping.php class=goshopping value='Go Shopping'></h2>";
  65. echo"</form>";
  66.  
  67. ?>
  68. <footer>
  69. <p>Copyright &copy; 2019 - All Rights Reserved</p>
  70. <p>Nisha Shrestha</p>
  71. </footer>
  72. </body>
  73. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement