Page 1 of 1

printing value in phpsessID

Posted: Sat Jul 27, 2002 3:02 pm
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]

Posted: Sat Jul 27, 2002 7:03 pm
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

Posted: Sun Jul 28, 2002 5:35 am
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 />';
?>