I cannot get a form I built to pass a re-calculated variable total value properly. I can get it to pass, but only when it does the math wrong, other than that it breaks the form process. Here is my explanation, hopefully it makes sense, but feel free to ask for clarification if need be.
I am working on a Paypal order form process. My problems are on step three and four of the process. Here is a short explanation of the order from process.
Page 1. Gets price and product info
Page 2. Order is sent to paypal to get address info and authorization
Page 3. Order is sent back to website with info, tax is calculated on the amount, submit here to complete the order.
Page 4. Order is sent and finalized
On page three there is a cost value that I must recalculate to add a tax amount to if the address is from California "CA" My problem lies in that code.
There are two variable values that I am trying to recalculate tax for and pass along. These values need to be the same
The following code below will pass the variable on in the form process, however it does the calculation wrong adding tax to the amount that already has tax on it, everything else I have tried breaks the order process.
<!-- this is code from page three of the form process -->
$caltax = (($_REQUEST['paymentAmount'] - $_REQUEST['SHIPPINGAMT']) * 0.0925);
if ($resArray['SHIPTOSTATE'] == 'CA')
$_REQUEST['paymentAmount'] = ($_REQUEST['paymentAmount'] + $caltax);
$_SESSION['paymentAmount'] = ($_SESSION['paymentAmount'] + $caltax);
<!-- I use this to display the form output on page three -->
<?= number_format ($_SESSION['paymentAmount'], 2); ?> <?= number_format ($_REQUEST['paymentAmount'], 2); ?>
<!-- this code processes the input on page four -->
$paymentAmount =urlencode ($_SESSION['paymentAmount']);