sherleon
asked on
Submit Two Forms with One Submit Button
This is another question that I have researched repeatedly over the years and have yet to find a workable answer. Given how web pages process information these days, it has to be a very common issue.
I have a membership application form. Four things need to be done with the information: it is written to a log file, it is emailed to both the applicant and to the secretary, it is updated in a database and it is passed to Paypal for payment. The first three tasks are accomplished by submitting the form to a VBScript page. Next, a separate form is submitted to Paypal:
{
document.paypalForm.submit ();
document.emailForm.submit( );
}
I've read repeatedly that two submits with one button won't work, but it works perfectly in IE. It doesn't work in most of the other browsers. There has to be a way to accomplish this. Hopefully, someone out there who has solved this problem and will share it.
I have a membership application form. Four things need to be done with the information: it is written to a log file, it is emailed to both the applicant and to the secretary, it is updated in a database and it is passed to Paypal for payment. The first three tasks are accomplished by submitting the form to a VBScript page. Next, a separate form is submitted to Paypal:
{
document.paypalForm.submit
document.emailForm.submit(
}
I've read repeatedly that two submits with one button won't work, but it works perfectly in IE. It doesn't work in most of the other browsers. There has to be a way to accomplish this. Hopefully, someone out there who has solved this problem and will share it.
ASKER
I'd thought to do it this way but wasn't sure how to handle the Paypal submit. I'm not familiar with a CURL request but will do some research. I'll give it a try today. It would so make my life simpler.
ASKER
OK, I'm going to have to take this a step at a time. All of the data for the database, log file, emails and Paypal are assembled in the main entry form. With my latest updates, I'm passing everything needed for db, log and emails to the VBScript page. I assume I should now include the Paypal data. I have several entry forms, so the number of fields for Paypal varies considerably (I have a separate VBScript for each form). I then assemble a CURL request with the Paypal values passed to hand off to Paypal?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I didn't mean to accept this as an answer. After the initial response it was ignored for nearly a month. I asked for help and never got it. I found the answer myself. I'm not renewing my subscription.
What I would recommend is using Express Checkout. This works over API calls and opens you up to more freedom to build your checkout system the way you want.
You can add a simple CURL request to pass PayPal all of the order data to start the checkout, and they will pass back a token. You simply add this token to the end of a redirect URL to PayPal, so when the VBscript is done running the next thing the user would see is the PayPal login (or guest checkout) option.
Once the user is done at PayPal it will send them back to whatever ReturnURL you specify in your SetExpressCheckout request.
You could also do the same thing a little bit more simply by just building a URL for the payment. You can use any of the PayPal Standard Variables within a URL to create a payment and simply redirect the user to that URL.
For example, here's a "buy me a beer" URL I've used a lot over the years.
Open in new window
You'll see if you load that URL it'll take you into a payment using those parameters, and again, you can include as many parameters as you want from that standard variable list.
I personally prefer Express Checkout, but whatever you think is best for your project would work fine.