You are here: Re: how to get values of a redirected a POST request ? « PHP Programming Language « IT news, forums, messages
Re: how to get values of a redirected a POST request ?

Posted by Jerry Stuckle on 12/18/11 11:50

Carl wrote:
> NC wrote:
>
>>Carl wrote:
>>
>>>these are three files below :
>>
>>[Snippets deleted]
>>
>>
>>>When I submit, it does redirect to 'post.php', but it doesn't show
>>>"test". If I change the submit.html to use the "GET" method ,and append
>>>"?value={$_GET['value']}" to the url int the redirect.php, it works
>>>well. Why the "POST" method doesn't work?
>>
>>Because redirection uses the GET method.
>>
>>You should consider either including post.php into redirect.php or
>>saving the POSTed values into session variables:
>>
>>redirect.php
>><?php
>> session_start();
>> $_SESSION = $_POST;
>> header("HTTP/1.1 303 See Other");
>> header("Location: post.php");
>>?>
>>
>>post.php
>><?php
>> session_start();
>> if(isset($_SESSION['value'])) {
>> echo "the value is : <font color=RED >{$_SESSION['value']}</font>";
>> }
>>?>
>>
>>Cheers,
>>NC
>
>
> In fact ,the destination that I want to redirect to is not developed by
> me , and they won't change their code for me. They use "POST" to get
> values ,I have to redirect the POST request.
>

As others have said - you can't redirect post values. They're sent as part of
the request for the page, and a redirect doesn't resend them.

Your only real choices are to use CURL or send the header information yourself.

Then pass the results back to the client.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

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

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