Question: how to make a function in php that discounts a price with a code if(isset($_POST['submit']) && isset($_POST['discount'])) { $discount = filter_input(INPUT_POST, discount); if(IsInjected($discount)) $errors .=

how to make a function in php that discounts a price with a code

if(isset($_POST['submit']) && isset($_POST['discount'])) {

$discount = filter_input(INPUT_POST, "discount");

if(IsInjected($discount))

$errors .= " Bad discount value!";

if($discount == "redund1" || $discount == "refund2") {

$cost -= 5;

var_dump($cost);

$errors .= "A $5 discount has been added to your total";

}

in order form, but cant figure out how to put in pay form for the total.

$final_cost = number_format($cost, 2);

$_SESSION["cost_final"] = $final_cost;

print "

Total: $$final_cost


";

there is an array above that figures out what has been ordered to total that for different options of my product, but i dont know how to get the discount in from my order file to pay file. please help!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!