Jump to content

Multiple action on form submit


valyent

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...