Forum Moderators: coopster

Message Too Old, No Replies

Form needs to be processed by two pages

Action script 1 then forward variables to page 2?

         

mcfly

8:42 pm on Mar 2, 2004 (gmt 0)

10+ Year Member



Hi all,

I have recently written a custom shopping cart for an e-commerce site that links to a separate credit card processing site. The user enters their delivery details on our site, then they are transferred to the CC processor's site with their details being passed as post variables.

However, because the details a shopper enters in the final form on our site are posted directly to the CC processor, I can't access them to update a database. Is there some way of executing a script with the post variables then sending the form data to the CC processor as well in just one click for the user?

I've heard people speak of 'background posts' but I'm not sure what they are or if they're possible with PHP. I realise the problem could be solved by inserting an 'summary page' between requesting a delivery address and transfering to the CC processor, but was hoping for a more elegant solution.

Any suggestions would be much appreciated. Thanks!

Bigjohn

10:32 pm on Mar 2, 2004 (gmt 0)

10+ Year Member



if the FORM exists on your server / web page, then you ought to be able to gather them up using $_POST[formvarname].

I was given this code to test the variables:


foreach ($_POST as $fieldname => $value) {
echo "$fieldname is $value<br />";
}

If that is on your target page (form action =)
then you'll get all the output. OF course this just displays the fieldname and its value. Once you confirm that the data is there, you can assign

$var1=$_GET['formvar1'];

etc.
I would then think that you could then feed them all to a form that is sent to the CC processor.

John
PS - I'm a NEWBIE.. others may have MUCH better advise.

mcfly

9:34 am on Mar 3, 2004 (gmt 0)

10+ Year Member



Hi John,

Thanks for your suggestion.

As I understand it, although I could gather-up the post variables, do something useful with them, then populate a second form with them, the shopper would always be required to submit the second form.

I'm hoping to find a way to automate this in some way, whether it involves automatically submitting the second form (is this possible?) or using some other method.

Bigjohn

11:54 am on Mar 3, 2004 (gmt 0)

10+ Year Member



What currently happens when your user hits 'submit' on the form?

ahmed

11:59 am on Mar 3, 2004 (gmt 0)

10+ Year Member



look at paypal's PHP example on this page (you'll need to sign-in /sign-up to paypal first):
[paypal.com...]

it shows how a page can receive a post request, and then re-post the variables back to another script.

I think that's what you're looking for?

mcfly

9:27 pm on Mar 4, 2004 (gmt 0)

10+ Year Member



John, at the moment the action of the form sends the form data to the CC processor server, so the problem is that I can't access it without interrupting the transmission.

Ahmed, I think that might be what I had in mind. Thanks very much.