r O h I t H wrote:
OK try dis:
You must define the value of the variable that you are going to register in a session BEFORE actually registering it.
So our new code wil be:
first.php
<?php
start_session();
$test="hello";
session_register("test");
?>
<a href="second.php">to second page</a>
second.php
<?php
start session();
echo $_SESSION['test'];
?>
It's session_start(); -> not start_session(); ;-)
New style PHP coding:
1st page:
<?php
session_start();
$_SESSION["test"] = "hello";
?>
<a href="second.php">to second page</a>
2nd page:
<?php
session_start();
echo $_SESSION["test"];
?>