Possible Duplicate:
php headers already sent error
I have attached my code which am using for a very basic login in php. It giving an error
Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\netsentries\f\includes\functions.php:1)
<?php
if (!isset($_POST['username'])) {
?>
<h3>Login</h3>
<form action="" method="post">
Username<br/>
<input name="username" type="text" /><br/>
Password<br/>
<input name="password" type="password" /><br/>
<input name="" type="submit" /><br/>
</form>
<?php
}
else
{
include('includes/config.php');
$data['username']= $_POST['username'];
$data['password']= md5($_POST['password']);
connect($db_name,$db_user,$db_pass,$db_host);
$query= "select * from user where username='" . $data['username'] . "' AND password='" . $data['password'] . "'";
$result=mysql_query($query);
//check that at least one row was returned
$rowCheck = mysql_num_rows($result);
if($rowCheck > 0)
{
while($row = mysql_fetch_array($result))
{
session_start();
session_register($data['username']);
//successful login code will go here...
//echo 'Logged in!';
}
}
else
{
echo "Failed!";
}
}
?>
Am not able to find out the problem