Session are handled in PHP by using the function session_start() . This function should be invoked before any HTML tags in the script.
<head> ....... etc
A random session id is generated by the function session_start(). This session id is persisted in a cookie on the client / user computer. To refer the cookie, the reference variable $PHPSESSID is used. This is the default session id. The session id can be changed in the PHP configuration files on the server.
Even the user returns this page after visiting some pages, PHP keeps track about this session and its progress. Subsequent to this process, the session can be used as follows –
The user name is registered and by using session variable name username and used it for display.
Posted in: PHP