As I said... >Not quite sure where you got this $login class instance from, but it >appears to be from thin air. If you have a session class then you would need >to instantiate it first with: > >$login = new XYZSessionClass(); // plus any constructor arguments
And to quote from the manual page you gave the link to: "To use this class, simply create a new object $login = new mySession("name");" "Daevid Vincent" <[EMAIL PROTECTED]> wrote in message 003c01c20826$451f3dd0$45193e04@telecom">news:003c01c20826$451f3dd0$45193e04@telecom... > Thank you john for the prompt reply, however I must be completely > retarded. I do this: > > <?php > session_start(); > > if( $login->getSessionVar("login") ) > { > $booth_id = $login->getSessionVar("booth_id"); > $booth_name = $login->getSessionVar("booth_name"); > echo "\n<BR>booth_id = $booth_id and booth_name = > $booth_name<BR>\n"; > } > else > { > Header("Location: ../index.phtml\n\n"); > exit; > } > > echo "this session is named: ".session_name()."<BR>\n"; > > include("../globalassets/include/header.phtml"); > ?> > > And I get this error: > > Fatal error: Call to a member function on a non-object in content.phtml > on line 4 > > > -----Original Message----- > > From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, May 30, 2002 12:19 PM > > To: Daevid Vincent; PHP general mailing list > > Subject: Re: [PHP] Help with example session class (second request) > > > > > > Call session_start() on your second page... > > > > ---John Holmes... > > > > ----- Original Message ----- > > From: "Daevid Vincent" <[EMAIL PROTECTED]> > > To: "PHP general mailing list" <[EMAIL PROTECTED]> > > Sent: Thursday, May 30, 2002 3:10 PM > > Subject: [PHP] Help with example session class (second request) > > > > > > > Sorry for posting this again so soon, but until I get sessions > > > working, I'm blocked on this project. > > > > > > D. > > > ----------- > > > > > > I'm just learning sessions, and thought the class looked > > interesting > > > on this page: http://www.php.net/manual/en/ref.session.php > > > > > > So I have this on an index.phtml page and I can see the > > variables are > > > being set and all looks good there, however upon successful > > "login" I > > > wish to redirect to content.phtml At the very top of content.phtml I > > > have: > > > > > > <?php > > > if( $login->getSessionVar("login") ) > > > { > > > $booth_id = $login->getSessionVar("booth_id"); > > > $booth_name = $login->getSessionVar("booth_name"); > > > echo "\n<BR>booth_id = $booth_id and booth_name = > > > $booth_name<BR>\n"; > > > } > > > else > > > { > > > Header("Location: ../index.phtml\n\n"); > > > exit; > > > } > > > ?> > > > > > > But it doesn't seem that $login exists or is defined now on > > this page? > > > > > > So my question is basically, how can I use the class and > > the session > > > variables across multiple pages? Do I need to move the class to an > > > include file? Do I need to re-create it on each page somehow? Can > > > someone show me a real working example of this scenario? > > > > > > Daevid Vincent > > > http://daevid.com > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php