重定向PHP页面
问题描述:
当我单击下一步按钮时,单击保存按钮并将我的页面重定向到next.php时,我想将页面重定向到save.php。重定向PHP页面
<form name="crtext" method="post" action="o_crt_ext.php" enctype="multipart/form-data">
<input type="submit" name="save" value="save" />
<input type="submit" name="next" value="next" />
</form>
o_crt_ext.php
<?php
if(isset($_POST['save']));
{
header("location:save.php");
}
if(isset($_POST['next']));
{
header("location:next.php");
}
?>
答
卸下分号的if语句
o_crt_ext.php
<?php
if(isset($_POST['save']))
{
header("location:save.php");
}
if(isset($_POST['next']))
{
header("location:next.php");
}
?>
+0
啊,我怎么会想念那些:) +1 – Jacob
+2
这就是为什么你不把新括号放在一个新的行。 –
答
你想,如果发送任何信息该用户点击下一步按钮?不是:在这里你走。
<form name="crtext" method="post" action="o_crt_ext.php" enctype="multipart/form-data">
<input type="submit" name="save" value="save" />
<input type="button" onclick="window.location.href='next.php'" value="next" />
</form>
不要忘记在发送位置标题后调用'exit'或者您可能会收到不需要的行为。 –