Hi !!
how can i retrieve a session variable ?
after doing this:
<a href="something.php?PHPSESSID=<?php $HTTP_SESSION_VARS["variable"] ?>&something=something">
how can i retrieve the session variable in the other document ?
regards!!
retrieving session variables
Moderator: General Moderators
- feiticeir0
- Forum Newbie
- Posts: 8
- Joined: Tue Nov 05, 2002 1:33 pm
- Location: Castelo Branco, Portugal
I'm not sure if I understood your question correctly but....
You can assign variable to $HTTP_SESSION_VARS
Then on any other page using that session this variable is accessible as
$HTTP_SESSION_VARS['something']
Hope that helped.
Rincewind_the_Wizzard
You can assign variable to $HTTP_SESSION_VARS
Code: Select all
<?php
$HTTP_SESSION_VARSї'something'] = $something;
?>$HTTP_SESSION_VARS['something']
Hope that helped.
Rincewind_the_Wizzard
-
persaltier
- Forum Newbie
- Posts: 3
- Joined: Wed Dec 18, 2002 10:50 pm
- Location: NYC
to retrieve the variable on subsequent pages, you'll need to first invoke the session for that page...
you'd do this by starting the session at the top of the page --->
you'll then refer to the session variable using the $_SESSION superglobal if you're using PHP 4.1 + or $HHTP_SESSION_VAR if you're using an older version.
you'd do this by starting the session at the top of the page --->
Code: Select all
<?php
session_start();
?>Code: Select all
<?php
echo $_SESSION[yourvar]; \\ echos your variable in 4.1+
echo $HTTP_SESSION_VAR[yourvar]; \\ <4.1
?>