I'm just starting to work with PHP sessions but I am running into some trouble...mostly they don't seem to work for me at all. I am working with two very simple test files in order to get the basics down.
In the first file I set a session variable $test, then as a quick check we output it again. I also provide a link to the second page in order to see if the variable transfers. The source code of the page is as follows:
<?php
session_start();
session_register("test");
$test = "test";
?>
<head>
<title>Session test</title>
</head>
<body>
<?php
echo "the value of our session variable is: " . $test;
?>
<a href="test2.php">Let's try Test on a second page</a>
I get the following output:
the value of our session variable is: test Let's try Test on a second page
The second page is even simpler simply echoing the variable $test. Source code is as follows:
<head>
<title> session test 2</title>
</head>
<body>
<?
echo "the value of \$test is $test";
?>
</body>
Output looks like this:
the value of $test is
I have no idea why the variable is not passing from one page to another.
Any help is greatly appriciated.
-Andy Nortrup