I have an include file.
In this include file there is a function that attempts to create a session variable.
The code this function uses to create a session variable is:
$TestData = 69;
if(session_register('TestData'))
echo "<p>Done</p>";
else
echo "<p>Error</p>";
$TestData = 69;
Then there is another function within the include file:
function checkObject()
{
session_register('TestData');
echo "<p>Test data out: " . $TestData . "</p>";
}
The include file is included in another php file. at the head of this php file there is a session_start() when I call the function to create the session variable from this page it prints out "Done". Then I call checkObject and the testdata is not printed out.
Am I doing this correctly how do you set a session variable and access from any point of code???
I know this kind of question has been asked before and I read in the archives but there wasnt a kind of fool proof explanation...
Thanks
TMC