<?php
include("connect.php");
if(isset($_POST['submit']))
{
$qonax=@$_POST['qonax'];
$subject=@$_POST['subject'];
$insert="INSERT INTO subject(ID,Qonax,Subject)VALUES('','$qonax','$subject')";
mysqli_query($link,$insert) or die(mysql_error($link));
}
header('location:insert_subject.php');
?>
写(if(isset($_POST['submit']){ }
时会出现此错误
删除此行代码时修复了一个问题。
答案 0 :(得分:0)
移动if块内的重定向并取消设置$_POST['submit']
变量
<?php
include("connect.php");
if(isset($_POST['submit']))
{
$qonax=@$_POST['qonax'];
$subject=@$_POST['subject'];
$insert="INSERT INTO subject(ID,Qonax,Subject)VALUES('','$qonax','$subject')";
mysqli_query($link,$insert) or die(mysql_error($link));
unset($_POST['submit'])
header('location:insert_subject.php');
}
?>