I've been searching around google and the archives here off and on for a few days trying to figure this and no dice.
My situation is this. I'm modifying a shopping cart for a client that uses a 3rd party credit card processor. (i.e. PayPal, 2Checkout, PaySystems)
Originally the cart relied on the 3rd party to post the data back. What I've found since I started coding here is that that method is unreliable since sometimes the info doesn't come back and order data is lost.
What I want to do is precapture the data and keep it stored in a session until the very last minute.
Ideally the customer will get a confirmation page where he/she can look over his/her stuff and make any changes needed. At that point they press submit and it will shoot them to a script I have made. It's at this point that I want it to write data to our database and then forward to the processor.
That's easy. Write to your database and toss in a header(location: wherever).
Problem is, I need a number of POST variables to go with the location change. (Our merchant ID, the customer info so they don't have to retype it, etc.)
Is there a way to do this? I know I can have it write the data and then go to page with a bunch of hidden form variables that auto submits, but that's not a very elegant solution and if it doesn't redirect you get the whole "click here if your browser and/or connection sucks because you didn't get redirected" page that, if it occurs, adds one more annoying step for the customer.
I'm guessing I can toss more info in the header() function. I just don't know how to format it for POST vars (assuming it is possible). With my limitted knowledge of how headers work, this seems like the easiest method to me.
I don't want to use GET because then all the user's data is right there and that's just annoying.
I could have the data written at the the last page just before they submit, but then if they make changes and come back, the database has to be hit again and I want to avoid that. (No updates, only inserts.)
So, to conclude, not only do I need the data posted to the 3rd party but I also need the user to be forwarded there with the data as if they had posted to that page themselves. The reason it isn't directly posted is because I want the data from the session written to the database at that very moment.
Anyway... thanks in advance.