[nycphp-talk] submitting two forms with one button - possible?
Rolan Yang
rolan at omnistep.com
Thu May 22 11:33:43 EDT 2008
One way would be to do an ajax call to submit the form #1 data to your
database, then upon acknowledgment of success, do a regular form submit
to payal (I'm guessing the user is supposed to be redirected to paypal
to complete the transaction).
The other way would be to do a regular submit, pass all the info (paypal
also) to a second php page, which processes the form #1 data then does a
redirect to paypal. You could add the paypal info in the url (not so
nice) or paste it into a form as hidden variables, then do a javascript
<body onLoad="document.mypaypalform.submit()"> so that the form is
automatically submitted on page load. For maximum non-javascript
compatibility, you should include a <input type="submit" value="Click
here to continue"> in the form.
~Rolan
Kristina Anderson wrote:
> I have a PHP page with two forms. One form posts the form data and
> inserts it into the database. The second form contains Paypal hidden
> variables and passes the transaction to the Paypal site. This has to
> happen seamlessly with one button and I can't combine the two forms as
> Paypal form has standard format for their form...
>
> How to do this? Can I call the second form submit programmatically at
> the end of the first form submit in PHP? Or with Javascript on the
> second form submit call the first form to be submitted?
> -------------------
> Kristina
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
>
More information about the talk
mailing list