Changes

Jump to: navigation, search

Understanding PHP Sessions

419 bytes added, 17:09, 6 June 2007
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>

Navigation menu