"Warning:Cannot modify header information -" Error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All !
I am having some problem with the code below. Everytime I run it it gives me the following error:
Warning: Cannot modify header information - headers already sent
by (output started at
C:\xampp\htdocs\practice.com\displayUserData.php:7) in C:\xampp\htdocs\practice.com\displayUserData.php on line 12

The source code of the page is as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<title> new document </title>
</head>
<body>
<?php $textColor = $_POST["TextColor"];
$boldText = $_POST["boldText"];
$userComments = stripslashes($_POST['userComments']);
if(isset($_POST["saveInfo"]))
{
setcookie("userData",$userComments,time()+60*60*24*30);
}
if(isset($_POST['boldText']))
{
echo "<b>";
}
echo "<font color='$textColor'>";
echo $userComments;
echo "</font>";
if (isset($_POST["boldText"]))
{
    echo "</b>";
}
?></body>
</html>

If I comment the setcookie() part, it works fine.. I looked up for some online help n most of them say I might have a whitespace near the line number mentioned in the warning message. But I don't find any.. Please help !



      Did you know? You can CHAT without downloading messenger. Go to http://in.messenger.yahoo.com/webmessengerpromo.php/ 

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux