Changes

Jump to: navigation, search

Understanding PHP Sessions

4 bytes removed, 12:29, 7 October 2009
Creating and Reading PHP Session Variables
<body>
<?php
$_SESSION['userName'] = 'JohnW';  if (session_is_registered('userName'))
{
$_SESSION['userName'] = 'Neil';
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.

Navigation menu