Jump to content

I was hoping to find a sticky on this; can 1 button sumbit 2 forms?


Recommended Posts

Posted

FormA uses a PHP form mail script that sends an email to the recipient, sends and autoresponder to the user, and forwards the user to their confirmation page to review what they submitted.

 

FormB is the other form which includes hidden id variables and strings using a POST method to connect to a https:// payment url. The hidden variables hold merchants account number and some other information specific to its function. It does not need to transmit data from FormA.

 

So Form A and B are completely independent of each other. and ultimately we would like 1 button to trigger both forms.

 

Right now user sees Form B's button on Form A's thankyou page. They fill out the form, go to the thank you page and press another button to go to the payment page. which works but adds 3 extra steps.

 

I thought about a JS solution and maybe cURL to carry out the action of Form B I kind think the solution would be PHP based because if the form can sen out an autoresponder, error warnings to admins I think it could send out data to another predetermined URL maybe using a GET method.

 

any thoughts?

.

Posted (edited)

I just goggled for about 20 minutes and all I could find were JS solutions. Apparently most were saying it's the only way. Here is one - there were a few others I came across as well. http://www.urbanpuddle.com/articles/2007/06/21/quick-tip-submit-two-forms-w-one-button Hope that helps :)

 

Here is another (3rd post) http://www.phpbuilder.com/board/showthread.php?t=10351103

Edited by Eric
Posted

So, why are the forms separate? Is it not possible to combine both forms to submit to the same PHP script to be processed?

 

What you've already mentioned - cURL and GET are the only ways I think you can do it. I have had similar problems with PayPal submissions, where I try to prevent people from changing the values in hidden fields, to be submitted directly to PayPal. Submitting from within a script would make the transaction secure.

 

It seems like an obvious thing to do but it is exceedingly difficult to initiate a POST from within a PHP script.

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
×
×
  • Create New...