I have just migrated my application from a local WAMP to the actual online server. This has caused trouble with the session ID not being saved as it appears.
You must have to write session_start(); before accessing any session variables, without it you will not able to access the session variables.
Try to put session_start() on the very first line of the file.