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? Quote 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. Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.