How can I redirect and pass the POST data?

This is a discussion on How can I redirect and pass the POST data? within the PHP Language forums, part of the PHP Programming Forums category; I would like to make a redirect and pass the POST data to the redirected page from the original page. ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-04-2006
Fred Weinhaus
 
Posts: n/a
Default 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
Reply With Quote
  #2 (permalink)  
Old 03-04-2006
Carl Vondrick
 
Posts: n/a
Default Re: How can I redirect and pass the POST data?

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
Reply With Quote
  #3 (permalink)  
Old 03-04-2006
David Haynes
 
Posts: n/a
Default Re: How can I redirect and pass the POST data?

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.

Reply With Quote
  #4 (permalink)  
Old 03-04-2006
Richard Levasseur
 
Posts: n/a
Default Re: How can I redirect and pass the POST data?

$_REQUEST is the combination of get, post, cookie, in that order.

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

Reply With Quote
  #5 (permalink)  
Old 03-05-2006
Jerry Stuckle
 
Posts: n/a
Default Re: How can I redirect and pass the POST data?

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.
jstucklex@attglobal.net
==================
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:14 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0