firedrop84 Posted March 30, 2006 Share Posted March 30, 2006 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<?phpsession_start();?><?phpprint "Your Surname is $Surname";?> Link to comment https://forums.phpfreaks.com/topic/6177-problem-with-sessions/ Share on other sites More sharing options...
Guest footballkid4 Posted March 30, 2006 Share Posted March 30, 2006 Number 1: Never ever ever ever ever use session_register(), especially with register_globals on. Use this script:[code]<?phpsession_start();$_SESSION['surname'] = "SURNAME";//other sessions?>[/code][code]<?php//Page Twosession_start();print_r( $_SESSION );?>[/code] Link to comment https://forums.phpfreaks.com/topic/6177-problem-with-sessions/#findComment-22303 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.