我不知道为什么我的代码无法重定向......我犯了什么错误......它显示一个警告是(((警告:无法修改标题信息 - 标题已经发送)))......请任何人告诉我需要更改什么才能成功重定向...我的代码是::
<?php
include_once $_SERVER['DOCUMENT_ROOT'].'/include/db.inc.php' ;
$email = $_POST['email'];
$password1 = $_POST['password1'];
$password2 = $_POST['password2'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
if($password1 != $password2)
{
header('Location: http://localhost/home/');
echo "<script language=javascript> alert(\"RE-ENTERED PASSWORD DOESN'T MATCH WITH THE ORIGINAL ONE\");</script>";
exit();
}
if($firstname == "" or $firstname == "First Name")
{
header('Location: http://localhost/home/');
echo "<script language=javascript> alert(\"INVALID FIRST NAME\");</script>";
exit();
}
if($lastname == "" or $lastname == "Last Name")
{
header('Location: http://localhost/home/');
echo "<script language=javascript> alert(\"INVALID LAST NAME\");</script>";
exit();
}
//INSERTION INTO THE DATABASE STARTS FROM HERE.........
$email = mysqli_real_escape_string($link,$_POST['email']);
$password1= mysqli_real_escape_string($link,$_POST['password1']);
$firstname= mysqli_real_escape_string($link,$_POST['firstname']);
$lastname= mysqli_real_escape_string($link,$_POST['lastname']);
$password=md5($password1);
$sql = "INSERT INTO users SET
email = '$email',
password = '$password',
firstname = '$firstname',
lastname = '$lastname'";
if (!mysqli_query($link, $sql))
{
header('Location: http://localhost/home/');
echo "<script language=javascript> alert(\"THIS E-MAIL ID HAS ALREADY USED BEFORE !!!\");</script>";
exit();
}
else
{
header('Location: http://localhost/home/');
echo "<script language=javascript> alert(\"REGISTRATION SUCCESSFULLY COMPLETED !!! \");</script>";
exit();
}
?>