Jump to content

feasters

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

feasters's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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. <!doctype html> <html> <head> <title>Your Store</title> <link rel="stylesheet" href="style.css"> <script type="text/javascript" src="jquery-1.4.4.min.js"></script> <script type="text/javascript" src="jquery.validate.min.js"></script> <script type="text/javascript" src="jquery.validate.creditcardtypes.js"></script> <script> $(document).ready(function(){ $("#register").validate(); }); </script> </head> <body><div class="container"> <h2>Please Register</h2> <form method="post" action="select_size.php" id="register"> <fieldset> <div> <label>First Name</label> <input type="text" class="text required" size="15" name="x_first_name" > </input> </div> <div> <label>Last Name</label> <input type="text" class="text required" size="14" name="x_last_name" ></input> </div> </fieldset> <fieldset> <div> <label>Daytime Telephone or Cell #</label> <input type="text" class="text required" size="25" name="x_phone" ></input> </div> </fieldset> <fieldset> <div> <label>Ship To State</label> <input type="text" class="text required" size="2" name="x_state" ></input> </div> </fieldset> <input type="submit" class="submit" value="Continue"> </form> <img src="footer_image.png" width="800" height="283"><img src="footer_bar.png" width="800" height="22"></div> </body> </html> I then post that value and use it as the condition in the next step: <?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']; } $state = $_POST['x_state']; 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 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!!
  2. 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
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.