Re: Using and Echoing Session Variables
| From: | Harlequin | Date: | Sun, 18 Jul 2004 10:47:02 +0000 |
| Subject: | Re: Using and Echoing Session Variables | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-190899@lists.php.net to get a copy of this message | ||
Thanks very much Tularis :)
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
"Tularis" <tularis@php.net> wrote in message
news:20040718101744.37275.qmail@pb1.pair.com...
> you need to call session_start() on every page, yes.
> Also, if you're bored with assigning values like that, and you're sure
> you're not overwriting anything, you could try:
> $_SESSION = array('UserId'=>'userid',
'Authorised'=>'yes','etc'=>'blah');
>
> However, remember that you don't need to REassign values to $_SESSION to
> keep them stored over multiple visits! :)
>
> hope that helps,
> - Tul
>
> 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(); ?>
> >
> > ??? Confused...!
> >
> > Also - rather than list the session variables the way I am new line
session,
> > new line session etc. is there a better way...?
> >