monty187 Posted June 6, 2007 Share Posted June 6, 2007 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 More sharing options...
papaface Posted June 6, 2007 Share Posted June 6, 2007 You'd have to use sessions. Link to comment https://forums.phpfreaks.com/topic/54371-solved-php-redirect-with-post-data/#findComment-268900 Share on other sites More sharing options...
thefortrees Posted June 6, 2007 Share Posted June 6, 2007 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. Link to comment https://forums.phpfreaks.com/topic/54371-solved-php-redirect-with-post-data/#findComment-268944 Share on other sites More sharing options...
MemphiS Posted June 6, 2007 Share Posted June 6, 2007 If its not a login and just Sending$_POST data to community.php. You can simple use html. <form action="community.php" method="POST"> Link to comment https://forums.phpfreaks.com/topic/54371-solved-php-redirect-with-post-data/#findComment-268947 Share on other sites More sharing options...
mmarif4u Posted June 6, 2007 Share Posted June 6, 2007 Sending data from one page to another you can use session or GET method with url in header. But better way is to use sessions. Link to comment https://forums.phpfreaks.com/topic/54371-solved-php-redirect-with-post-data/#findComment-268953 Share on other sites More sharing options...
monty187 Posted June 6, 2007 Author Share Posted June 6, 2007 Thanks a million again guys, I used the 'MemphiS' htlm method and it worked. Somtimes the simplest solution is the best one:) Link to comment https://forums.phpfreaks.com/topic/54371-solved-php-redirect-with-post-data/#findComment-269101 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.