Jump to content

[SOLVED] php redirect with post data


monty187

Recommended Posts

Hi guys,

 

I need to use a redirect statement to redirect users to another page when they submit a form. Then on the next page I want to use the POST data, is this possible or is their a better way to do it? At the moment the form has action move() below

 

function move()
{
header("Location: community.php");
    exit;
}

 

Will this method now work and allow me to use the post data from the page?

 

Thanks

Monty

Link to comment
https://forums.phpfreaks.com/topic/54371-solved-php-redirect-with-post-data/
Share on other sites

you can set a cookie or use sessions.

http://us.php.net/manual/en/features.cookies.php

 

If you want to use cookies, just read up on the setcookie function...

setcookie("cookiename", $_POST['whatever]', other parameters ......)

 

Then when you want to use the post data from your first page, you can just do:

$postdata = $_COOKIE['cookiename'];

 

and that should do it.

Be sure that you set your cookies before anything is sent to the browser, wont work otherwise.

 

Sessions work too.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.