We can read, create, and delete sessions over a single
$_SESSION global array. The only important issue is that we must write the
session_start() function at the top of each page before we start using session, which prepares the session event and is essential.
On some servers, session usage is always on automatically, and if you try to write
session_start() on open servers, it will fail. In this case there is no need to use this function.
<?php session_start(); $_SESSION['message'] = 'Hello world!'; ?>
Above we started a session,added a key
message inside the global array
$_SESSION with the value
Hello world!. So I’ve created a session called
message and its value is
This value will be sent back to every page he visits unless the browser is closed and the user will be able to remember his previous actions, such as username or password.