Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 349
  • Last Modified:

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.
0
sherleon
Asked:
sherleon
  • 4
1 Solution
 
Andrew AngellCommented:
You can add just add the PayPal stuff to the bottom of your VBscript so that you don't have to show a separate form.

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.

https://www.paypal.com/xclick/business=paypalemail@domain.com&item_name=1%20Beer&currency_code=USD&amount=5.00&shipping=0.00&handling=0.00&tax=0.00

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.
0
 
sherleonAuthor Commented:
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.
0
 
sherleonAuthor Commented:
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?
0
 
sherleonAuthor Commented:
I verified that the VBScript page is receiving all the Paypal variables. I've been researching all afternoon how to do the submit and am stumped. Can you help me to get started on where to go from here.
0
 
sherleonAuthor Commented:
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.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now