problem using SESSION

From: Date: Wed, 09 Aug 2000 19:32:32 +0000
Subject: problem using SESSION
Groups: php.general 
Request: Send a blank email to php-general+get-10986@lists.php.net to get a copy of this message
Hello List, I have recently installed php4 and I am experementing with sessions. I have a page containing the following code: <? session_start(); session_register("SESSION"); if (! isset($SESSION)) { $SESSION["count"] = 0; echo "<li>Counter initialized, please reload this page to see it increment"; } else { echo "<li>Waking up session $PHPSESSID"; $SESSION["count"]++; } echo "<li>The counter is now $SESSION[count] "; ?> However, when I view this page I get the following error: Warning: Cannot send session cookie - headers already sent by (output started at /usr/local/apache/htdocs/test.php:5) in /usr/local/apache/htdocs/test.php on line 15 Warning: Cannot send session cache limiter - headers already sent by (output started at /usr/local/apache/htdocs/test.php:5) in /usr/local/apache/htdocs/test.php on line 15 Counter initialized, please reload this page to see it increment The counter is now 0

« previous php.general (#10986) next »