You have to put it at the top of the page prior to anything else.

<?php

        session_start();

        //proceed with other code

?>

> -----Original Message-----
> From: Alex Hogan [mailto:[EMAIL PROTECTED]
> Sent: January 20, 2004 1:45 PM
> To: 'PHP General list'
> Subject: RE: [PHP] $_SESSION
> 
> 
> Yeah..., I tried that.
> 
> I got back an error that read;
> Warning: session_start(): Cannot send session cookie - headers already
> sent
> by....
> Warning: session_start(): Cannot send session cache limiter - headers
> already sent.....
> 
> 
> 
> 
> > -----Original Message-----
> > From: Aaron Wolski [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, January 20, 2004 12:31 PM
> > To: 'Alex Hogan'; 'PHP General list'
> > Subject: RE: [PHP] $_SESSION
> >
> > You need to call session_start() on each page.
> >
> > > -----Original Message-----
> > > From: Alex Hogan [mailto:[EMAIL PROTECTED]
> > > Sent: January 20, 2004 1:29 PM
> > > To: PHP General list
> > > Subject: [PHP] $_SESSION
> > >
> > > I've got a question that I'm sure has a simple answer.
> > >
> > >
> > >
> > > Why aren't my session objects transferring across more than one
page?
> > >
> > >
> > >
> > > I'm calling a session object that was set in the page prior;
> > >
> > > $_SESSION['mysessionvar'] = $_REQUEST['mytxtobj'];
> > >
> > >
> > >
> > > I then assign a variable that value;
> > >
> > > $myvar = $_SESSION['mysessionvar'];
> > >
> > >
> > >
> > > echo $myvar;
> > >
> > >
> > >
> > > This displays like I expected.  However when I go to the next page
and
> > > want
> > > to display this var again I get either an Undefined index or
variable.
> > > According to the docs $_SESSION[] is now global and this is the
way of
> > > setting and retrieving session objects, right?
> > >
> > >
> > >
> > > I have tried calling that session object again but it's empty and
so
> > is
> > > the
> > > variable.  I thought that the session would stay open until I
close
> > the
> > > browser and I could return those values any time I wanted.  Am I
> > missing
> > > something?
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > alex hogan
> > >
> > >
> > >
> > >
> > >
> > > ******************************************************************
> > > The contents of this e-mail and any files transmitted with it are
> > > confidential and intended solely for the use of the individual or
> > > entity to whom it is addressed.  The views stated herein do not
> > > necessarily represent the view of the company.  If you are not the
> > > intended recipient of this e-mail you may not copy, forward,
> > > disclose, or otherwise use it or any part of it in any form
> > > whatsoever.  If you have received this e-mail in error please
> > > e-mail the sender.
> > > ******************************************************************
> > >
> 
> 
> 
> ******************************************************************
> The contents of this e-mail and any files transmitted with it are
> confidential and intended solely for the use of the individual or
> entity to whom it is addressed.  The views stated herein do not
> necessarily represent the view of the company.  If you are not the
> intended recipient of this e-mail you may not copy, forward,
> disclose, or otherwise use it or any part of it in any form
> whatsoever.  If you have received this e-mail in error please
> e-mail the sender.
> ******************************************************************
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to