The following code will let me redirect the page to a new location, and take the GET
variables with me..
<?php
// set GET variables
$name="John";
$email="me@there.com"
// redirect the page
header("Location: ../process.php?name=$name&email=$email");
?>
How can I do exactly the same thing and take POST
variables with me?
I need to do this to simulate another page that has a form and submit button on it. Normally, on that page, the user would press the submit button and the POST
data would be sent to process.php
. I need my new page, after performing some processing, to re-direct to process.php
with the POST
data. This needs to happen without anyone pressing a button.
I can't use sessions, as the page I am simulating does not do this - it just sends the POST
data when the submit button is pressed.
I can't use javascript as there is no-user interaction to press a button - it is purely a program-branch that will cause this to happen.
I don't mind using curl or JQuery, but haven't been able to figure out how to do it from the code I have already found. I would be very grateful for a working example, please.