Newbie error with cookies and headers already declared

From: Date: Fri, 21 May 2004 20:28:34 +0000
Subject: Newbie error with cookies and headers already declared
Groups: php.general 
Request: Send a blank email to php-general+get-186728@lists.php.net to get a copy of this message
I'm getting this error: Warning: Cannot add header information - headers already sent by (output started at /home/tiempodemaria/main.php:3) in /home/tiempodemaria/main.php on line 11 With this code in "main.php": <html> <? define(SECONDS_IN_THREE_MONTHS, 3600*24*90); define(OFFSET_WITH_GMT, -3*3600); $has_visited = isset($_COOKIE["TdM_visited"]); if (!$has_visited) { setcookie("TdM_visited", (string) (time() + OFFSET_WITH_GMT), time() + OFFSET_WITH_GMT + SECONDS_IN_THREE_MONTHS); // the above (not blank) is line 11 } else { $latestVisit = (int) $_COOKIE["TdM_visited"]; setcookie("TdM_visited", (string) (time() + OFFSET_WITH_GMT), time() + OFFSET_WITH_GMT + SECONDS_IN_THREE_MONTHS); } ?> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="styles/main_style.css" rel="stylesheet" type="text/css"> <body> ..... Does anybody knows what's going on? I don't understand which header is being sent before the setting of the cookie, and I don't understand the ":3" in the error description. This page is a frame, so I don't have any head tag, does that matter to php? Thanks in advance, Nicolas

« previous php.general (#186728) next »