problems with sessions.
| From: | Deepak Chawla | Date: | Wed, 01 Nov 2000 09:05:26 +0000 |
| Subject: | problems with sessions. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-23116@lists.php.net to get a copy of this message | ||
I recently started working with sessions... and have already started
running into problems. Someone please help me out...
I have two (almost identical) .php files. I have the --enable-trans-sid
set.
----------------session01.php------------------------
<html>
<head> <title> Session 01 </title>
</head>
<body>
<p> This is the first file in session. The variable is
<?
session_start();
session_register("count");
print("$count");
$count++;
?>
</p>
<p> Now go to <a href="session02.php"> Click here </a> </p>
</body>
</html>
-----------------------------------------------------------------
----------------------session02.php-----------------------------
<html>
<head>
</head>
<body>
<p> This is the second file in session. The variable is
<?
session_start();
session_register("count");
print("$count");
$count++;
?>
</p>
<p> Now go back <a href="session01.php"> Click here </a> </p>
</body>
</html>
------------------------------------------------------------
Although the scripts are working, they are also producing some error
messages. I can't figure out why so. Can someone help me ?
----------------error messages-----------------------
This is the first file in session. The variable is
Warning: Cannot send session cookie - headers already sent by (output
started at /home/dchawla/public_html/Learning/session01.php:6) in
/home/dchawla/public_html/Learning/session01.php on line 7
Warning: Cannot send session cache limiter - headers already sent (output
started at /home/dchawla/public_html/Learning/session01.php:6) in
/home/dchawla/public_html/Learning/session01.php on line 7
0
Now go to Click here
---------------------------------------------------------------------
I even tried removing the session_start(); functions
(session_register(...); implicitly starts the session). But that didn't
help either.