header function not working: generates error
Posted: Sun Dec 06, 2009 12:12 pm
hi to all,
i m using header to call the file data.php on successful login, but it generates a error
"Warning: Cannot modify header information - headers already sent by (output started at /home3/oscobizz/public_html/login.php:9) in /home3/oscobizz/public_html/login.php on line 86
"....."line 86 has header function"
----------------------------------------------
this is the file code login.php
----------------------------------------------
<?php
if(isset($_POST['submit']))
{
$con = mysql_connect("localhost","oscobizz_osadmin","os-co123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("oscobizz_os", $con);
$chk = mysql_query("select * from members where name='".$_POST['name']."' and pass='".$_POST['pass']."'");
if(mysql_num_rows($chk)>0)
{
session_register('s_id');
$_SESSION['s_id']=1122;
header("Location:/data.php");
}
else
{
echo "Wrong Username or Password:";
unset($_SESSION['s_id']);
}
} //end of submit if
?>
---------------------------------------------------
what should i do ???
i m using header to call the file data.php on successful login, but it generates a error
"Warning: Cannot modify header information - headers already sent by (output started at /home3/oscobizz/public_html/login.php:9) in /home3/oscobizz/public_html/login.php on line 86
"....."line 86 has header function"
----------------------------------------------
this is the file code login.php
----------------------------------------------
<?php
if(isset($_POST['submit']))
{
$con = mysql_connect("localhost","oscobizz_osadmin","os-co123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("oscobizz_os", $con);
$chk = mysql_query("select * from members where name='".$_POST['name']."' and pass='".$_POST['pass']."'");
if(mysql_num_rows($chk)>0)
{
session_register('s_id');
$_SESSION['s_id']=1122;
header("Location:/data.php");
}
else
{
echo "Wrong Username or Password:";
unset($_SESSION['s_id']);
}
} //end of submit if
?>
---------------------------------------------------
what should i do ???