Jump to content

problem with sessions


firedrop84

Recommended Posts

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";

?>
Link to comment
https://forums.phpfreaks.com/topic/6177-problem-with-sessions/
Share on other sites

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

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

[code]<?php
//Page Two
session_start();
print_r( $_SESSION );
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/6177-problem-with-sessions/#findComment-22303
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.