Professional Web Applications Themes

POSTing to another site on redirect - PHP Development

Hi All I'm building a shopping cart that ties in with PayPal for payments. After working out the postage charge, I want the user to be able to confirm if they'll sign up to a newsletter or not, and then to be taken to Paypal. I'd like to do all that with just one click. Paypal only lets you pass one hidden variable, and I need that to identify the customer in the back end stuff, so I can't check on the newsletter thing after payment. I'm looking for a way to process the form input myself, before sending the ...

  1. #1

    Default POSTing to another site on redirect

    Hi All

    I'm building a shopping cart that ties in with PayPal for payments.
    After working out the postage charge, I want the user to be able to
    confirm if they'll sign up to a newsletter or not, and then to be taken
    to Paypal. I'd like to do all that with just one click.

    Paypal only lets you pass one hidden variable, and I need that to
    identify the customer in the back end stuff, so I can't check on the
    newsletter thing after payment.

    I'm looking for a way to process the form input myself, before sending
    the user to PayPal. How can I add POST data to a "Location" header?

    Although I could do it by sending them to a script that does the
    processing for the newsletter, and then uses javascript to submit the
    form values using post (e.g. <body onload="formname.submit();">) I'm
    trying to keep it javascript free, so it'll be 100% accessible.

    Anyone know how to add the headers (or have a suggestion how else I can
    do this)?

    Thanks

    Jim
    Jim Guest

  2. #2

    Default Re: POSTing to another site on redirect

    "Jim Evans" <com> wrote in message
    news:66ipe.3373$ntli.net... 

    PayPal allows for two hidden variables - are you using them all for options?

    As an alternative, would it be possible to include the required data along
    with the customer ID info? I'm guessing that this is info that is passed
    back to you after processing, right? So, let's say it was a hidden field -
    you could do something like: (I'm fudging the form name, since I don't
    remember the PayPal names offhand)

    print "<input type='hidden' name='paypaloption1'
    value='$customerID/subscribe-$subscribe'>\n";

    Of course, you would have to get the $customerID and $subscribe info in a
    previous field to do this.
     

    I don't think you can add POST data, but you can certainly add GET data.
    Have you tried PayPal with GET? I am under the impression that should work,
    from what I've done with PayPal before.

    Since this is PayPal specific, have you asked on the PayPal Developers
    Forum?
     

    Alternately, you could add a "continue" button with all the data in hidden
    fields, for those who don't have JavaScript enabled.

    Just some thoughts - maybe they'll give you an idea.


    Tony Guest

  3. Moderated Post

    Default Re: POSTing to another site on redirect

    Removed by Administrator
    Kimmo Guest
    Moderated Post

  4. #4

    Default Re: POSTing to another site on redirect

    Thanks Tony and Kimmo

    I'm being awkward and trying to avoid having to ask the visitor about
    the newsletter until after they've done the postage. I only want them to
    click once, and be taken straight to Paypal. That means I wouldn't be
    able to do any processing on it, such as concatenating or putting it
    into an array.

    I don't want the customer to see anything confusing - they'll be getting
    a breakdown of the cart contents in their paypal account so I can only
    use the paypal "custom" value, (which is never shown to the customer) to
    identify them in the IPN.

    Paypal works with GET, but if I pass more than a couple of cart items,
    plus the customer details, I'll run out of characters in the GET string.

    I hadn't really thought about asking on the paypal forums, as I was just
    looking at the PHP prblem of passing the POST stuff - but I guess that's
    going to have to be my next step.

    Thanks guys.

    Tony wrote: 
    >
    >
    > PayPal allows for two hidden variables - are you using them all for options?
    >
    > As an alternative, would it be possible to include the required data along
    > with the customer ID info? I'm guessing that this is info that is passed
    > back to you after processing, right? So, let's say it was a hidden field -
    > you could do something like: (I'm fudging the form name, since I don't
    > remember the PayPal names offhand)
    >
    > print "<input type='hidden' name='paypaloption1'
    > value='$customerID/subscribe-$subscribe'>\n";
    >
    > Of course, you would have to get the $customerID and $subscribe info in a
    > previous field to do this.
    >

    >
    >
    > I don't think you can add POST data, but you can certainly add GET data.
    > Have you tried PayPal with GET? I am under the impression that should work,
    > from what I've done with PayPal before.
    >
    > Since this is PayPal specific, have you asked on the PayPal Developers
    > Forum?
    >

    >
    >
    > Alternately, you could add a "continue" button with all the data in hidden
    > fields, for those who don't have JavaScript enabled.
    >
    > Just some thoughts - maybe they'll give you an idea.
    >
    >[/ref]
    Jim Guest

  5. #5

    Default Re: POSTing to another site on redirect

    "Jim Evans" <com> kirjoitti
    viestissä:Clppe.3744$ntli.net... 


    So what's wrong with processing the form once user _has_ decided about the
    newsletter, end then redirecting the user to paypal with
    header("Location: http://www.paypal.com?Put_your=get_methods_here");

    --
    "I am pro death penalty. That way people learn
    their lesson for the next time." -- Britney Spears

    com


    Kimmo Guest

  6. #6

    Default Re: POSTing to another site on redirect

    Hi Kimmo

    There's a limit on how many characters you can put in a GET request -
    and with a reasonably full cart, along with all the customer's details I
    can easily go over that. That's why it needs to be done by POST.

    Looks like I'm going to have to put the javascript onload thing into
    practice, with a "If this doesn't redirect you, click here" button to
    submit the form for non-javascript clients.

    Thanks anyway.

    Kimmo Laine wrote: 
    >
    >
    >
    > So what's wrong with processing the form once user _has_ decided about the
    > newsletter, end then redirecting the user to paypal with
    > header("Location: http://www.paypal.com?Put_your=get_methods_here");
    >[/ref]
    Jim Guest

Similar Threads

  1. Problems posting Video into Social Network Site
    By RobCashman in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: December 14th, 06:11 PM
  2. InDesign Windows posting to a web site
    By Jed_Johnston@adobeforums.com in forum Adobe Indesign Windows
    Replies: 2
    Last Post: May 31st, 05:39 PM
  3. Posting photos on web site question
    By KM in forum Photography
    Replies: 3
    Last Post: August 16th, 06:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139