Advertisement
Guest User

s

a guest
Dec 11th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. <?php
  2. if (!isset($product_description)) { $product_description = ''; }
  3. if (!isset($list_price)) { $list_price = ''; }
  4. if (!isset($discount_percent)) { $discount_percent = ''; }
  5. if (!isset($Sales_Tax_Rate)) { $Sales_Tax_Rate = ''; }
  6.  
  7.  
  8.  
  9.  
  10. if ($_SERVER["REQUEST_METHOD"]== "POST") {
  11. $product_description= FILTER_input(INPUT_POST, '$product_description',FILTER_VALIDATE_FLOAT );
  12. $list_price= FILTER_input(INPUT_POST, '$list_price' , FILTER_VALIDATE_FLOAT) ;
  13. $discount_percent = FILTER_input(INPUT_POST ,'$discount_percent', FILTER_VALIDATE_INT);
  14. $Sales_Tax_Rate = FILTER_input(INPUT_POST, '$Sales_Tax_Rate', FILTER_VALIDATE_INT);
  15. }
  16.  
  17. ?>
  18.  
  19.  
  20.  
  21. <!DOCTYPE html>
  22. <html>
  23. <head>
  24. <title>Product Discount Calculator</title>
  25. <link rel="stylesheet" type="text/css" href="main.css">
  26. </head>
  27.  
  28. <body>
  29. <main>
  30. <h1>Product Discount Calculator</h1>
  31. <?php if (!empty($error_message)) { ?>
  32. <p class="error"><?php echo $error_message; ?></p>
  33. <?php } // end if ?>
  34. <form action="display_discount.php" method="post">
  35.  
  36.  
  37.  
  38. <div id="data">
  39. <label>Product Description:</label>
  40. <input type="text" name="product_description"
  41. value="<?php echo htmlspecialchars($product_description); ?>"><br>
  42.  
  43. <label>List Price:</label>
  44. <input type="text" name="list_price"
  45. value="<?php echo htmlspecialchars($list_price); ?>"><br>
  46.  
  47. <label>Discount Percent:</label>
  48. <input type="text" name="discount_percent"
  49. value="<?php echo htmlspecialchars($discount_percent); ?>">
  50.  
  51. <label>Sales Tax:</label>
  52. <input type="text" name="Sales_Tax_Rate"
  53. value="<?php echo htmlspecialchars($Sales_Tax_Rate); ?>">
  54.  
  55. <span>%</span><br>
  56. <input type="checkbox" value="8" name="chk_tax"/><label for="latest-events">Tax Percentage</label>
  57.  
  58. </div>
  59.  
  60. <div id="buttons">
  61. <label>&nbsp;</label>
  62. <input type="submit" value="Calculate Discount"><br>
  63.  
  64. </div>
  65.  
  66.  
  67. </form>
  68.  
  69. </main>
  70. </body>
  71. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement