webmaster1 Posted April 15, 2010 Share Posted April 15, 2010 I've read the manual. I have the following: <?php if($count==1){ session_register("loginusername"); session_register("loginpassword"); header("location:/somewhere"); } ?> Since this approach is deprecated I've tried replacing the functions with the superglobals: <?php if($count==1){ $_SESSION['loginusername'] = $loginusername; $_SESSION['loginpassword'] = $loginpassword; header("/somehwere"); } ?> How do I correctly define the session variables? Should I be using session_start? Link to comment https://forums.phpfreaks.com/topic/198664-how-do-i-create-superglobal-session-variables/ Share on other sites More sharing options...
Ken2k7 Posted April 15, 2010 Share Posted April 15, 2010 Yes. Place session_start at the beginning of the PHP script. Link to comment https://forums.phpfreaks.com/topic/198664-how-do-i-create-superglobal-session-variables/#findComment-1042560 Share on other sites More sharing options...
webmaster1 Posted April 15, 2010 Author Share Posted April 15, 2010 Nuts. I had tried placing it at the beginning of my if else condition. Thanks Ken. Link to comment https://forums.phpfreaks.com/topic/198664-how-do-i-create-superglobal-session-variables/#findComment-1042576 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.