feasters
-
Posts
2 -
Joined
-
Last visited
Never
Posts posted by feasters
-
-
Hi All, having trouble with the following and would be grateful for any assistance. The code below is the part of a multi-step form that calculates the sales tax of a simple order form for Authorize.net (AIM API). I would like to add an if, else condition that processes the $amount function with tax if the state is florida, otherwise, it processes the $amount without tax. Here is the code:
<?php require_once '../config.php'; $coffee_store_relay_url = $site_root . "process_sale.php"; /** * Sets the possible coffee choices. */ $prices_array = array( "1 Case of Howards Best Coconut Water" => "24.99", "2 Cases of Howards Best Coconut Water" => "47.99", ); $size = "small"; // Set Default Size if (isset($_POST['size']) && isset($prices_array[$_POST['size']])) { $size = $_POST['size']; } if($state == 'FL') $price = $prices_array[$size]; // Set Price $tax = number_format($price * .07,2); // Set tax $amount = number_format($price + $tax,2); // Set total amount else $price = $prices_array[$size]; // Set Price $tax = number_format($price * .0,2); // Set tax $amount = number_format($price + $tax,2); // Set total amount
If, else condition within a form
in PHP Coding Help
Posted
Yes, thank you, but that was only part of my problem. The form is not processing the if, else properly. Here is the code to the first step (Registration) where the state value is captured.
I then post that value and use it as the condition in the next step:
As it is now, no matter what value is entered for state, it still multiplies it by the .07, rather than the .00.
Please help!!