Jump to content


Photo

problem with sessions


  • Please log in to reply
1 reply to this topic

#1 firedrop84

firedrop84
  • Members
  • PipPipPip
  • Advanced Member
  • 49 posts

Posted 30 March 2006 - 02:28 PM

Hi ..

I am trying to use sessions but I got a problem with it. I can't display it in the other page. After the user login and I try to use session so I can refer to the variables in the other page it doesn't.

in the login screen this is the code that I have used. at the begging of my page

<?php
session_start();
session_register('EmployeeID');
session_register('Surname');
session_register('GivenName');
session_register('EmployeeUsername');
session_register('EmployeePassword');
session_register('EmployeeType');
session_register('Active');
?>

in the other page this is what I done

<?php
session_start();
?>

<?php

print "Your Surname is $Surname";

?>


#2 Guest_footballkid4_*

Guest_footballkid4_*
  • Guests

Posted 30 March 2006 - 02:36 PM

Number 1: Never ever ever ever ever use session_register(), especially with register_globals on. Use this script:

<?php
session_start();
$_SESSION['surname'] = "SURNAME";
//other sessions
?>

<?php
//Page Two
session_start();
print_r( $_SESSION );
?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users