Welcome to WebmasterWorld Guest from 174.129.151.95

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

two action within one form?

can this be done

   
7:40 pm on Oct 28, 2003 (gmt 0)

10+ Year Member



Hi,

I've got a form where the action is a redirect to a payment gateway page.
The onsubmit does javascript validation to ensure the fields are complete.

This has worked fine for a couple of years but now I want to create a mysql database entry of the customer details before they go through to the payment gateway.

I have tried having the php program that does the database entry as the action from the form with a redirect to the payment gateway in the php program, that worked but there were no values in the form by the time it got to the payment gateway.
Has anyone come across this problem and more important has anyone solved it?

Cheers

Andy

8:00 pm on Oct 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello,

When you redirect In your PHP/db script, add the POSTED data onto the URL.

Example:

$redirect_url = "Location: paymentgateway.com?name=$name&email=$email...etc";
header($redirect_url)

or, I think this would work:

$redirect_url = "Location: paymentgateway.com$_SERVER['query_string']";
header($redirect_url)

10:44 am on Oct 29, 2003 (gmt 0)

10+ Year Member



Hi Birdman,

I had thought of adding the paremeters to the payment gateway url, but the restriction on passing parameters is 255 characters I believe. This limit could easily be hit with the data being transfered so that's not an option.

Would it be possible to send the form twice?

First time to update the database and then the second time to the payment gateway?

Cheers

Andy

10:55 am on Oct 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



then you have to use the POST method and place the data in the document body from within PHP.

SN

1:48 pm on Oct 29, 2003 (gmt 0)

10+ Year Member



I would POST the form to one of your own pages, do the database insert, then use a utility like "curl" to forward the information to the payment gateway.
7:11 pm on Oct 30, 2003 (gmt 0)

10+ Year Member



Hi,

Thanks for your advice, I looked at various options, but in the end I reconfigured the results sent from the payment gateway to display a more user friendly "thank you" page and updated the database from there.

Cheers

Andy