user4fun Posted March 17, 2009 Share Posted March 17, 2009 page 1 session_register("myusername");session_register("mypassword"); echo "Session registered under username = ". $_SESSION['myusername']; The output shows the session variable myusername and it is correctBUT When I do this session_register("myusername");session_register("mypassword"); header("location:office_manager.php"); and this in office_manager.php echo "Session registered under username = ". $_SESSION['myusername']; the seesion variable is empty! How can I fix this problem? Link to comment Share on other sites More sharing options...
Synook Posted March 17, 2009 Share Posted March 17, 2009 You need to call session_start() at the very top of every page you use sessions on. Link to comment Share on other sites More sharing options...
justsomeguy Posted March 17, 2009 Share Posted March 17, 2009 Also, session_register and session_unregister have been deprecated. It's better to just use the $_SESSION array. If you want to delete a session variable, you can use unset. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.