34,333
edits
Changes
→Creating and Reading PHP Session Variables
<body>
<?php
$_SESSION['userName'] = 'JohnW'; if (session_is_registered('userName'))
{
echo 'userName = ' . $_SESSION['userName'];
}
The resulting output from the above page will read:
<tt>userName = NeilJohnW</tt><br>
The same PHP code to read the value can be used on any page on your web server to access the current value of the variable.