I have a problem with a form. I need it to perform two actions with only one submit click. I’ve read that the best solution is a server-side script, but my knowledge of PHP is pretty limited, so I’d really appreciate any help.
The two actions I need to perform are:
- Run a script that uploads a file and sends an email (
action="uploader.php") - Direct the user to a PayPal payment gateway (
action="https://www.paypal.com/cgi-bin/webscr")
As I see it, the problem is that I don’t have control over the PayPal script, but it obviously takes some data from the form (i.e. amount, concept, etc…), so adding a simple redirect in uploader.php isn’t enough.
What do you think? How could I solve it?
Thanks!
UPDATE: I’ll try to post the user-action flow:
- user fills in the form and adds a file to upload
- 1st form action: file is uploaded and an email is sent (
action="uploader.php") - 2nd form action: user is taken to a paypal payment form (
action="https://www.paypal.com/cgi-bin/webscr") - When the purchase is completed the user is taken to a purchase confirmation page.
Your uploader.php should show the new paypal form (or the same) to user and submit it by javascript on dom ready.
Don’t forget about non-javascript users too.