-2
我的PHP代码重定向到提供的页面,而不显示警告框,即使我已经在代码中提供了它。这里是代码:重定向没有警报框
$query = mysql_query ("select * from registered_users WHERE reg_no='".$regno."'");
$numrows = mysql_num_rows($query);
if($numrows == 0)
{
$sql = "INSERT INTO registered_users(name,reg_no,username,password,email_id,phone_no) VALUES ('$name','$regno','$uname','$pass','$email','$phone')";
$result = mysql_query($sql);
if($result == 1)
{
echo "<script type='text/javascript'>alert('Registered Successfully.')</script>";
header("Location:/magz/index - Copy.php");
}
}
你正在输出之前标题btw http://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php和错误报告会告诉你,所以http:///php.net/manual/en/function.error-reporting.php –