Jump to content

Multiple action on form submit


valyent
 Share

Recommended Posts

I have a form collecting registration data, on submit, I have a confirmation page displaying data via php (session var), followed by a form with a "confirmed" checkbox. On submit, if confirmed, I want two actions: to post the data to MySQL and open a new window with PayPal interface to accept credit card payment. Elementary but logic eludes.Is the location function only way to redirect? How do I format a location redirect with multiple input data?I see redirect is tricky. What page structure and php method would be best to get this done?

Link to comment
Share on other sites

One way is to use Javascript to see if the checkbox is checked and open the new window before the form submits, then the form submits to go to the database and you display a thank you page or whatever. You can also have the form processor output Javascript code to open a new window. A location header is only used for a redirect, the only thing you send with a location header is the URL to redirect to. You can't tell the browser to open a new window with a location header.

Link to comment
Share on other sites

Can I reverse that? Can I have javascript look at the checkbox and, if true, direct php to post variables to database and echo confirm, this happening on same page? Then on "submit payment" the form redirects to the PayPal interface in _blank window?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...