From: "Ed Curtis" <[EMAIL PROTECTED]> > I just started using sessions and am having some trouble understanding how > to pull values out of sessions to use in another page. > > I set the values as: > > session_start(); > session_register{'magazine'); > session_register('company'); > > The data is saved as a session because I can read the file located in my > /tmp directory. > > Now I click on a link and go to a different page and I do: > > session_start() > > Magazine: <? echo $magazine; ?> > > Company: <? echo $company; ?> > > Should I be able to retrieve the values in this fashion? I'm using php > 4.1.2.
As you sit there and wait for us to answer, you could have taken the 5 second to run this yourself and test it. If register_globals is ON, then yes, that's how you do it. You may want to actually assign a value to $magazine and $company in the first script, though, if you want to see any results. If register_globals is OFF, then you should do it this way: Page 1: session_start(); $_SESSION['magazine'] = 'some value'; $_SESSION['company'] = 'some other value'; Page 2: <?php session_start(); ?> Magazine: <?php echo $_SESSION['magazine']; ?> Company: <?php echo $_SESSION['company']; ?> ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php