Re: Using and Echoing Session Variables

From: Date: Sun, 18 Jul 2004 10:22:29 +0000
Subject: Re: Using and Echoing Session Variables
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-190896@lists.php.net to get a copy of this message
I've no problem declaring variables that way - used to it from VB anyway. Just wondered if there was a better way that's all. -- ----------------------------- Michael Mason Arras People www.arraspeople.co.uk ----------------------------- "Jason Barnett" <jasbarne@indiana.edu> wrote in message news:20040718100850.10142.qmail@pb1.pair.com... > Harlequin wrote: > > > Hi everyone. A few quick pointers if you have time... > > > > I've created a session, easy enough: > > <?php session_start(); ?> > > > > I've created variables: > > $_SESSION['UserID'] = UserID; > > $_SESSION['Authorised']="yes"; > > $_SESSION['logname'] = $logname; > > > > When a user clicks a link to a test page I created the following doesn't > > work though: > > echo $_SESSION["UserID"]; > > > > Do I need to use the (again): > > <?php session_start(); ?> > > Yep - any time you want sessions you need to start them (every page). This can > be avoided with a php.ini setting, but that is just evil so we'll pretend I > didn't suggest that :) > > > > > ??? Confused...! > > > > Also - rather than list the session variables the way I am new line session, > > new line session etc. is there a better way...? > > > > The way you're assigning session variables is fine. There are other ways you > *could* do it; what are you aiming for?

« previous php.general (#190896) next »