|  | Posted by Jerry Stuckle on 06/19/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
 ==================
 [Back to original message] |