how to send redirect page pass variables as post variables from a php script

前端 未结 3 1888
余生分开走
余生分开走 2021-01-27 18:13

you can find a similar question here PHP Post Request inside a POST Request but this is not working in my context.

I have a form (reservation form for a tour website) an

3条回答
  •  不要未来只要你来
    2021-01-27 18:37

    You can't. HTTP makes no provisions for redirecting with anything in the request body (which is where POST data goes). You can only redirect with a GET request. So the typical way to do this is to take the user to a second page that has a button to "Continue to PayPal", or something of that nature. That button POSTs all the data to PayPal as normal.

    For what it's worth, if this is for the PayPal "Buy Now" button, they actually (even if not documented) allow sending all those form variables in the GET request, via the URL. We do this in one of our applications where we "track" the start of the payment process and then redirect to a PayPal URL containing all the form fields as a query string, then "complete" the transaction as the user returns.

提交回复
热议问题