Re: Help with Sessions
| From: | Tom Rogers | Date: | Fri, 28 Feb 2003 15:57:32 +0000 |
| Subject: | Re: Help with Sessions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137580@lists.php.net to get a copy of this message | ||
Hi,
Saturday, March 1, 2003, 1:54:24 AM, you wrote:
PKI> Hi
PKI> I just have a little problem with sessions.
PKI> my code:
PKI> <htmL>
PKI> <head><title>TEST</title>
PKI> </head>
PKI> <body>
PKI> <?php
PKI> session_start();
PKI> if ($submit) {
PKI> echo 'Hello '.$_SESSION['ID'];
PKI> } else {
PKI> $_SESSION['ID']=2;
PKI> echo "<form>\n";
PKI> echo "<input type=submit name=submit>\n";
PKI> echo "</form>\n";
PKI> }
?>>
PKI> </body>
PKI> </html>
PKI> my error msgs:
PKI> Warning: Cannot send session cookie - headers already sent by (output
PKI> started at d:\apache_docroots\internal.infomart.ca\infodesk\test.php:6) in
PKI> d:\apache_docroots\internal.infomart.ca\infodesk\test.php on line 8
PKI> Warning: Cannot send session cache limiter - headers already sent (output
PKI> started at d:\apache_docroots\internal.infomart.ca\infodesk\test.php:6) in
PKI> d:\apache_docroots\internal.infomart.ca\infodesk\test.php on line 8
PKI> Can anyone please help? Thanks....
move session_start() to the first line in your file
--
regards,
Tom