我有三頁的start.html使page2.php和final.php發送一個隱藏的後變量和查詢字符串得到變量
的start.html需要某種形式的數據變量(名字,姓氏,城市,狀態)並使用POST表單將其發送到page2.php。
然後我想使用不同的方法將這些post變量發送到final.php。 firstname和lastname作爲查詢字符串(GET變量),並將城市和州作爲隱藏變量通過POST傳遞給page3。
我明白如何分別做每一件事,但一次可以做兩件事嗎?
什麼我都試過了,這是一個最好的客人,就使page2.php:
<?php
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$city = $_POST['city'];
$state = $_POST['state'];
$url = "final.php?firstname=".$firstname."&lastname=".$lastname;
<form action="<?php echo $url; ?>" method="post">
<input type="hidden" name ="city" value="<?php echo $city; ?>">
<input type="hidden" name ="state" value="<?php echo $state; ?>">
<input type="submit" value="next page">
</form>
?>
或頭(地點:$網址);
也許使用href?
您只能單獨執行一個'POST'或'GET',且每次只執行一個。爲什麼你需要發送一些作爲'GET'和一些作爲'POST'? – Blinkydamo
可能的重複,請檢查此:http://stackoverflow.com/questions/2749406/post-and-get-at-the-same-time-in-php – Pixel1002
上面的代碼沒有做你想要的嗎? $ _GET數組應該在'final.php'中填入第一個/最後一個名字,而$ _POST數組也可以使用city&state bby這個外觀......? – RamRaider