You are here: Re: How can I redirect and pass the POST data? « PHP Programming Language « IT news, forums, messages
Re: How can I redirect and pass the POST data?

Posted by David Haynes on 11/18/81 11:41

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация