重定向PHP页面

1 php redirect

我点击保存按钮时将我的页面重定向到save.php,当我点击下一步按钮时,我将页面重定向到next.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>
Run Code Online (Sandbox Code Playgroud)

o_crt_ext.php

<?php
if(isset($_POST['save']));
{
header("location:save.php");
}
if(isset($_POST['next']));
{
header("location:next.php");
}
?>
Run Code Online (Sandbox Code Playgroud)

Suf*_*ndy 6

删除if语句中的分号

o_crt_ext.php

<?php
if(isset($_POST['save']))
{
  header("location:save.php");
}
if(isset($_POST['next']))
{
  header("location:next.php");
}
?>
Run Code Online (Sandbox Code Playgroud)

  • 这就是为什么你不把括号放在新线上的原因. (2认同)