Note sure how to explain this clearly but here is the problem:
I have a multi-page form process which takes the customer from a shopping cart page to a shipping page. On the cart page there is a hidden field called totalPrice which has as it’s value an integer. I am calling this total on the shipping page like so:
$total = $_POST['totalCost'];
echo $total;
On this shipping page there is another form which asks the customer to choose a shipping method. When this form is submitted the totalCost is to be updated to reflect the added shipping cost.
I am trying to do that like this:
$total = $total + $shippingCost;
But this only shows the shipping cost when I echo $total again not the shipping added to the initial total. I guess that’s because the form has been submitted and the initial $total hidden value carried on from the previous form is lost.
So Is there any way to make the initial totalPrice value permanent so that I can add the shipping cost to it as well?
Use sessions!
http://lv.php.net/manual/en/session.examples.basic.php