34,333
edits
Changes
→Creating and Reading PHP Session Variables
?>
</pre>
Session variables are accessed by using the varioable name as an index key into the $_SESSION array. For example:
<pre>
<?php
session_start();
?>
<html>
<head>
<title>Simple HTML Form</title>
</head>
<body>
<?php
$_SESSION['userName'] = 'Neil';
echo 'userName = ' . $_SESSION['userName'];
?>
</body>
</html>
</pre>
The resulting output from the above page will read:
<tt>userName = Neil</tt><br>