1 回答

TA貢獻1802條經驗 獲得超10個贊
有幾種方法可以做到這一點:
使用 PHP 的
header('Location: /page-url');
$_POST
如果設置則渲染不同的內容
<?php
if (isset($_POST['submit'])) {
// Set Global Session Variables from Form's POST Values
$_SESSION["favcolor"] = $_POST['favcolor'];
$_SESSION["favanimal"] = $_POST['favanimal'];
// Render other page content
include "session2.php";
// end the script to prevent loading this page contents
die;
}
?>
<form action="" method="post">
Enter Color: <input type="text" name="favcolor" /><br />
Enter Animal: <input type="text" name="favanimal" /><br />
<input type="submit" value="submit" name="submit" />
</form>
通過 AJAX 請求提交表單并根據響應進行重定向
- 1 回答
- 0 關注
- 123 瀏覽
添加回答
舉報