Jump to content


Photo

$_SESSION


  • Please log in to reply
1 reply to this topic

#1 richie_ropey

richie_ropey
  • Members
  • Pip
  • Newbie
  • 5 posts

Posted 10 March 2006 - 10:55 AM

Is there a way to select all the variables currently registerd in the $_SESSION variable?

#2 txmedic03

txmedic03
  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 10 March 2006 - 11:00 AM

Certainly, but what would you like to do with them?

To process them one by one and write them out to the page.
<?php

while (list($key, $val)=each($_SESSION)) {
  echo "[".$key."]=>[".$val."]<br />";
}

?>

If you want you can change that code around a bit or you a for each instead of the while, but the short and sweet just to see all the elements of the array and their values is

<?php print_r($_SESSION); ?>

SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users