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 关注
- 97 浏览
添加回答
举报