-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 –