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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.