Advertisement
Guest User

php

a guest
Feb 25th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="description" content="Pizza">
  6. <meta name="keywords" content="Michael,lord,author,cis231,occ,sunyonondaga,Pizza,order">
  7. <meta name="author" content="Michael Lord" >
  8. <meta name="viewpoint" content="
  9. width: device-width;
  10. zoom: 1;
  11. min-zoom: 67%;
  12. max-zoom: 67%;
  13. user-zoom: fixed;"/>
  14. <title></title>
  15. <link rel="stylesheet" href="lab1.css">
  16. </head>
  17.  
  18.  
  19. <body>
  20. <div class="transbox">
  21.  
  22.  
  23.  
  24.  
  25. <?php
  26. if (!empty($_POST['name'])) {
  27. $Name = $_POST['name'];
  28. } else {
  29. $Name = NULL;
  30. echo '<p class="error">You forgot to enter your name! Please go back and enter your name.</p>';
  31. }
  32. if (isset($_POST["toppings"])) {
  33. $top = $_POST['toppings'];
  34. } else {
  35. $top = NULL;
  36. echo '<p class="error">You need to go back and select a topping please.</p>';
  37. }
  38. if (isset($_POST['ordertype'])) {
  39. $order = $_POST['ordertype'];
  40. } else {
  41. $order = NULL;
  42. echo '<p class="error">You have forgot to select your order</p>';
  43. }
  44. if (isset($_POST['quantity']) and is_numeric($_POST['quantity'])) {
  45. $quan = $_POST['quantity'];
  46. }
  47. else {
  48. $quan = NULL;
  49. echo '<p class="error">You have not selected a number of pizzas. Please go back and select a number of pizzas.</p'; }
  50.  
  51. $pizzacost = 8;
  52. if ($top == "meatlovers") {
  53. $pizzacost = $pizzacost + 3;
  54. }
  55. if ($top == "cheese") {
  56. $pizzacost = $pizzacost + 1.5;
  57. }
  58. if ($top == "extracheese") {
  59. $pizzacost = $pizzacost + 2.5;
  60. }
  61. if ($order == "delivered") {
  62. $total = 2;
  63. $total = $pizzacost * $quan + $total; }
  64. if ($order != "delivered") {
  65. $total = 0;
  66. $total = $pizzacost * $quan + $total; }
  67. ?>
  68. <h1>Thanks for the order, <?php echo "$Name" ?>!</h1>
  69. <center><p>Your total bill for pizza is: $<?php echo number_format($total, 2) ?></p>
  70. </center>
  71. </div>
  72.  
  73. </body>
  74. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement