|
i want to move to next page if login name and password is correct with this code:
<html>
<head>
<form method='post' action='login.php'>
<input type='text' name='login' size='12'>
<input type='password' name='password' size='12'>
<input type='submit' value='go'>
</form>
</head>
</html>
<?
$user="root";
$host="localhost";
$password="";
$database="class_8";
$connection=mysql_connect($host,$user,$password);
$db=mysql_select_db($database,$connection) or die( "Unable to select database");
$sql = "select login_name from login where login_name='$_POST[login]'";
$result=mysql_query($sql) or die ("couldnot excute query");
$num=mysql_num_rows($result);
if($num==1)
{
$sql2="(SELECT login_name FROM login WHERE login_name='$_POST[login]' AND password ='$_POST[password]')";
$result2=mysql_query($sql2) or die ("couldnot excute query1");
$num2=mysql_num_rows($result2);
}
if ($num2>0)
{
echo header("location:result.php");
}
elseif($num==0)
{
echo "username doesnot exist,plz try again";
}
else
{
echo "The login name, '$_POST(login)' exist, but you have entered incorrect password";
}
mysql_close();
?>
but what i see is:
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\xampp\htdocs\login.php:10) in C:\Program Files\xampp\htdocs\login.php on line 28
need help correcting this code plz
|