printing value in phpsessID

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kevin_bkk
Forum Newbie
Posts: 5
Joined: Fri Jul 19, 2002 12:27 pm

printing value in phpsessID

Post by kevin_bkk »

hello ,
in page one i creates session variable and register one variable as session variable assigning a value, for example "abcd"
in next page due to some reasons i could not reterive the value stored in session variable ,but iam getting the sessionId when i pass
print "$PHPSESSID,in next page
so my questions is that is it possible to read and display the value stored in sessionId, if possible how to do that ,
[/b]
daemorhedron
Forum Commoner
Posts: 52
Joined: Tue Jul 23, 2002 11:03 am

Post by daemorhedron »

Please make sure that you are using session_start() on both pages. You can use the session_id() function to get the current session_id.

HTH
User avatar
PaTTeR
Forum Commoner
Posts: 56
Joined: Wed Jul 10, 2002 7:39 am
Location: Bulgaria
Contact:

Post by PaTTeR »

In first page :

Code: Select all

<?php
session_start();
$variable = 'abcd';
session_register('variable');
?>
In second page :

Code: Select all

<?php
session_start();
echo 'Your session ID is: '.session_id().'<br />';
// if you have register_globals set on
echo 'The value of variable is: '.$variable.'<br />';
// if you don't have register_globals set on
echo 'The value of variable is: '.$HTTP_SESSION_VARS&#1111;variable].'<br />';
// or
echo 'The value of variable is: '.$_SESSION&#1111;variable].'<br />';
?>
Post Reply