Gossamer Forum
Home : General : Perl Programming :

How could I make a form with 2 different actions?

Quote Reply
How could I make a form with 2 different actions?
Hello,

I'm using a form for a party subscription. I need to have 2 different actions for that form.

The 1st one is to a cgi on my website to store the subscription data in a flat text file for internal use.

The 2nd is cgi to the payment gateway.

Once the submit button is clicked, the data should be sent both to my cgi + the payment gateway.

Is it possible?

Could you please help me?

Thanks a lot
Quote Reply
Re: [Lotz] How could I make a form with 2 different actions? In reply to
You don't need two form "actions". All you need to do is put the two "actions" in one CGI script.

EXAMPLE:

if ($in{'submit'} eq "process") {
- STORE STUFF IN YOUR DATABASE CODES
- REDIRECT TO PAYMENT GATEWAY STUFF CODES
}
Quote Reply
Re: [Stealth] How could I make a form with 2 different actions? In reply to
Thanks, but I'm not sure if I correctly understood.

Should I make a new cgi or should I add it to my cgi?

Could you please give me more details?

In your example, where you put:

- STORE STUFF IN YOUR DATABASE CODES

- REDIRECT TO PAYMENT GATEWAY STUFF CODES

Should I put the URLs of the 2 cgi?

Thanks a lot
Quote Reply
Re: [Lotz] How could I make a form with 2 different actions? In reply to
Should I make a new cgi or should I add it to my cgi?

You should have the two "actions" you want to do with the form in ONE cgi script.

I just gave an example of the logic you should employ, but basically, when someone clicks on the submit button, the first process (database insert) would spawn, then after it is complete, it would go to the gateway process, ideally in the same CGI script.
========================================
Buh Bye!

Cheers,
Me