Posted by radoo on 08/17/06 08:17
Before session_start() you have to make sure you don't have empty
spaces, or new lines or other characters.
Dennis de Wit wrote:
> Sonia Covarrubias wrote:
> > Ok.. to clarify, here's a code sample..
> >
> > <?php
> > session_start();
> > ?>
> > <html><head><title>Session Test Page</title></head>
> > <body>
> > <h1>Session Test Page!</h1>
> > <p>
> > <?php
> > echo '<b>session id:</b> '.session_id()."<p>";
> > $_SESSION['testvar'] = 'hello';
> > echo '<b>session variables:</b> ';
> > print_r($_SESSION);
> > ?>
> > </body></html>
> >
> > Here's the error message:
> >
> > Warning: session_start() [function.session-start]: Cannot send session
> > cookie - headers already sent by (output started at
> > C:\htdocs\php\sessiontest.php:1) in
> > C:\htdocs\php\sessiontest.php on line 2
> >
> > Something is wrong?
> >
> >
> >
>
> Check for enters on the top of your page (before the <?php tag). There
> shouldn't be any...
Navigation:
[Reply to this message]
|