Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!isset($product_description)) { $product_description = ''; }
- if (!isset($list_price)) { $list_price = ''; }
- if (!isset($discount_percent)) { $discount_percent = ''; }
- if (!isset($Sales_Tax_Rate)) { $Sales_Tax_Rate = ''; }
- if ($_SERVER["REQUEST_METHOD"]== "POST") {
- $product_description= FILTER_input(INPUT_POST, '$product_description',FILTER_VALIDATE_FLOAT );
- $list_price= FILTER_input(INPUT_POST, '$list_price' , FILTER_VALIDATE_FLOAT) ;
- $discount_percent = FILTER_input(INPUT_POST ,'$discount_percent', FILTER_VALIDATE_INT);
- $Sales_Tax_Rate = FILTER_input(INPUT_POST, '$Sales_Tax_Rate', FILTER_VALIDATE_INT);
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Product Discount Calculator</title>
- <link rel="stylesheet" type="text/css" href="main.css">
- </head>
- <body>
- <main>
- <h1>Product Discount Calculator</h1>
- <?php if (!empty($error_message)) { ?>
- <p class="error"><?php echo $error_message; ?></p>
- <?php } // end if ?>
- <form action="display_discount.php" method="post">
- <div id="data">
- <label>Product Description:</label>
- <input type="text" name="product_description"
- value="<?php echo htmlspecialchars($product_description); ?>"><br>
- <label>List Price:</label>
- <input type="text" name="list_price"
- value="<?php echo htmlspecialchars($list_price); ?>"><br>
- <label>Discount Percent:</label>
- <input type="text" name="discount_percent"
- value="<?php echo htmlspecialchars($discount_percent); ?>">
- <label>Sales Tax:</label>
- <input type="text" name="Sales_Tax_Rate"
- value="<?php echo htmlspecialchars($Sales_Tax_Rate); ?>">
- <span>%</span><br>
- <input type="checkbox" value="8" name="chk_tax"/><label for="latest-events">Tax Percentage</label>
- </div>
- <div id="buttons">
- <label> </label>
- <input type="submit" value="Calculate Discount"><br>
- </div>
- </form>
- </main>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement