我有HTML表單,我必須提交相同的頁面上的形式,其中的那種形式,添加POST變量,然後所有的變量傳遞到下一個頁面。我嘗試這樣做:PHP着POST變量
<form method="POST" action="">
<input type="TEXT" name="names" />
<input type="TEXT" name="email" />
<input type="submit" name="send" />
</form>
,然後這個PHP代碼:
if($_POST['send']){
$_POST['digest'] = "someText here";
header("HTTP/1.0 307 Temporary redirect");
header("Location:https://nextpage.com/form");
}
但是當我重定向到另一個網頁,所有的POST數據,不同的是 「$ _ POST [ '消化']」 發..我該怎麼辦 ?
感謝,併爲英語不好對不起。
你不得不添加'digest'到URL(這當然會變成一個GET變量,有長度的限制等),我不認爲有一種方法做你想要的東西。 (其實我很驚訝,瀏覽器重新發布POST數據到新的URL。這是記錄/預期?) – 2013-04-08 18:49:30
看http://stackoverflow.com/questions/653090/how-do-you-post-to- a-page-using-php-header-function – Heberfa 2013-04-08 18:51:48
@Pekka웃:它可能因瀏覽器而異。看到這個帖子:http://stackoverflow.com/questions/46582/response-redirect-with-post-instead-of-get – Alekc 2013-04-08 18:52:00