I am writing the code for handling Paypal payments on my site. Paypal gives you the code to write their buttons, which store the necessary variables in “hidden” inputs, which then get sent to PayPal’s website for checkout when the order button is clicked.
In my case, I want my page to check a couple things before going to the Paypal site, so I have the form action instead go to a validation page, and then use PHP in the header to check the $_POST data. I can do that… I’m just not sure how to now get the data moved onto the Paypal website, since the $_POST variables are only good for one page transition. And of course, I can’t store the $_POST variables as session variables since those are only good within site (and even if they could transfer to Paypal, they are looking for $_POST variables on their page).
I was thinking at first that I could use PHP to write a new form on the 2nd page, and the new form would contain hidden inputs with all the data filled out from the $_POST, and then use the tag trick to bump the page onward to the correct Paypal URL… but that wouldn’t be using form submission and therefore none of those hidden inputs will get sent.
Is there a way to have a submit button trigger automatically when it is loaded? That would solve the problem, I think.