Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.