How can I redirect to a page and add the $_POST variable with some info in it?
I know that with $_GET you have to append the variable to the URL like &var=foo
session_start();
$_SESSION = $_POST;
Then your POST params will be available via $_SESSION.
You can extract the data from $_POST
, and append it to the redirection URL :
header('Location: http://www.yoursite.com/test.php?var=' . urlencode($_POST['var']));
If you have more parameters, see http_build_query()
, to help building the query-string.
But note that this test.php
page will be loaded by the browser using the GET
method : the server cannot say to a browser to load another page using POST
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With