Re: Re[2]: [PHP] sessions help

From: Date: Thu, 13 Jun 2002 21:47:16 +0000
Subject: Re: Re[2]: [PHP] sessions help
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-102080@lists.php.net to get a copy of this message
Your problem is here.. > return ($_SESSION['node'] = $node_id); I do not believe that you can both set and return a varaible on the same line. FYI, the variable which you're returning in this function is global.. so there's no reason to return it anyway. Just fill the index and you're all set. -Kevin ----- Original Message ----- From: "Leston Drake" <ldrake@lpsoftware.com> To: <php-general@lists.php.net> Sent: Thursday, June 13, 2002 3:32 PM Subject: Re[2]: [PHP] sessions help > Thanks to Julie and Stuart for helping me. > > With your direction, I got rid of the warning about the headers by putting > the session_start() at the beginning of the file. > > Now I get a different sort of error when I try to retrive the session variable: > ------------------------------- > Warning: Undefined index: node in c:\program files\apache > group\apache\htdocs\wan\getglobal.php on line 17 > ------------------------------- > > Any ideas why? > > (Here's the exact code I've got) > [sessions.php] > <?php session_start();?> > <html> > <head> > <title>A test</title> > </head> > <body> > > <?php > function sessionSetNode ($node_id) { > return ($_SESSION['node'] = $node_id); > } > > sessionSetNode("10.2"); > ?> > > </body> > </html> > > [getglobal.php] > <?php session_start();?> > <html> > <head> > <title>A test</title> > </head> > <body> > > <?php > if (!empty($_SESSION)) { > extract($_SESSION); > } else if (!empty($HTTP_SESSION_VARS)) { > extract($HTTP_SESSION_VARS); > } > > function sessionGetNode () { > return $_SESSION['node']; > } > > $n = sessionGetNode(); > echo ("Node is $n."); > ?> > > </body> > </html> > > > TIA, > Leston > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#102080) next »