Hi
Answer to your first question is, after unregistering the session, ie call to session_unregister(), variable is
unregistered but is still available at ONLY that page. Try to access it on another page 🙂 Also, if you chane the
contents of the variable, after registering it, registered value is also changed.
Hope following examples would clear your concepts.....
copy them and try to run them on your server.....
Best Wishes............
Fahad
------------------------------ INDEX.php ------------------------
<?
// index.php
session_start();
$name = "me";
session_register("name");
$name = "you";
?>
<head>
<title> New Document </title>
</head>
<body bgcolor="#FFFFFF">
<?
echo $name; // Out put will be you, got it why?
?>
<br>
<a href="2.php">click here</a>
</body>
------------------------------ 2.php ------------------------
<?
// 2.php
session_start();
?>
<head>
<title> New Document </title>
</head>
<body bgcolor="#FFFFFF">
<?
echo $name; // Out put will be you, as variable was over written....
?>
<br>
<a href="3.php">click here</a>
</body>
------------------------------ 3.php ------------------------
<?
// 3.php
session_start();
session_unregister("name");
?>
<head>
<title> New Document </title>
</head>
<body bgcolor="#FFFFFF">
<?
echo $name; // is here but will not be on next page.........
?>
<br>
<a href="4.php">click here</a>
</body>
------------------------------ 4.php ------------------------
<?
// 3.php
session_start();
// NAME is not here!
?>
<head>
<title> New Document </title>
</head>
<body bgcolor="#FFFFFF">
<?
if(session_is_registered("name"))
echo ("NAME IS HERE");
else
echo ("NAME IS NOT HERE");
?>
</body>