Forum Moderators: coopster
So here's the very simplified code:
<?php
if (isset($_POST['shipchoice'])) {
$shipchoice = $_POST['shipchoice'];
}
?>
<html, etc...>
<!-- Display cart here with shipping method selected -->
<form method="post" name="shipping" action="<? echo $_SERVER['PHP_SELF']; ?>"><p>Select desired shipment method:
<input type="radio" name="shipopt" value="1st Class Mail" onclick="this.form.submit();";
<input type="radio" name="shipopt" value="Media Mail" onclick="this.form.submit();";
<input type="radio" name="shipopt" value="Priority Mail" onclick="this.form.submit();";
</form>
<form method="post" name="done_make_payment" action="authorize_payment.php">
<p>Enter any special requirements or comments:
<textarea name="comment"><? echo $_SESSION['comment']; ?></textarea>
<input type="submit" value="Make Payment">
</form>
In authorize_payment.php:
<?php
$_SESSION['comment'] = CleanFilter($_POST['comment']);
So if you follow what's happening. A person *could* change the shipping method. If they do that, the form is refreshed, and the cart is displayed with that new ship method. No problem there. They could also leave the shipping method as it was, and add a comment and authorize the payment. No problem there either. BUT if a person leaves a comment, then decides to also change the shipment method, that comment then disappears and they are forced to enter it again.
I really don't want to split this into two pages, and it's absolutely necessary that these two options are given. This is actually a page from a PayPal Express payment. The customer accesses PayPal, PalPal sends them to this page after verification, then this page sends the data to PayPal to finalize it.
I hope I didn't make this more complicated than it is.
IMO You could easily use AJAX to update anything you are updating with a full page refresh (form submission), but I really don't understand what you are doing very well.