470,855 Members | 1,143 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,855 developers. It's quick & easy.

How can I redirect and pass the POST data?

I would like to make a redirect and pass the POST data to the redirected
page from the original page. What is the easiest way to do this? Can one
do this by setting the header data in some way. If so, how? Is there a
better way without using sessions. I am rather new to PHP. Thanks

Fred Weinhaus
Mar 4 '06 #1
4 13016
Fred Weinhaus wrote:
I would like to make a redirect and pass the POST data to the redirected
page from the original page. What is the easiest way to do this? Can one
do this by setting the header data in some way. If so, how? Is there a
better way without using sessions. I am rather new to PHP. Thanks
You need to use fsockopen to simulate this.

However, if you want if to transfer contents from one page to another,
just use sessions.
Fred Weinhaus

--
Carl Vondrick
www.carlsoft.net
usenet [at] carlsoft [dot] net
Mar 4 '06 #2
Fred Weinhaus wrote:
I would like to make a redirect and pass the POST data to the redirected
page from the original page. What is the easiest way to do this? Can one
do this by setting the header data in some way. If so, how? Is there a
better way without using sessions. I am rather new to PHP. Thanks

Fred Weinhaus

Chaining POST pages without SESSIONs may be done with GETs.

page1.php grabs the $_POST array.
When it wants to call page2.php, it converts the $_POST values to $_GETs
by doing something like:

$gets='';
foreach($_POST as $key => $value) {
$gets = ($gets == '') ? $key.'='.$value : '&'.$key.'='.$value;
}
header("Location: page2.php?$gets");

page2.php would then grab the values via the $_GET array.

-david-

[UNTESTED] I think you can make pages POST/GET neutral through the
REQUEST array. I keep reminding myself to poke around in REQUEST when I
get some time.

Mar 4 '06 #3
$_REQUEST is the combination of get, post, cookie, in that order.

Cookie overrides parameters specified via post/get
Post overrides parameters specified via get

Mar 4 '06 #4
Richard Levasseur wrote:
$_REQUEST is the combination of get, post, cookie, in that order.

Cookie overrides parameters specified via post/get
Post overrides parameters specified via get


This depends entirely on the value in variable_order in your php.ini file.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 5 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Alex Hunsley | last post: by
8 posts views Thread by Victor | last post: by
2 posts views Thread by Darren Oakey | last post: by
3 posts views Thread by Brano | last post: by
5 posts views Thread by Thom Little | last post: by
5 posts views Thread by =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post: by
56 posts views Thread by UKuser | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.