Maybe it is just cos it is Friday and my head is already gone away for
the weekend but I just cannot get sessions working!
Anyway - two pages. Page one starts session and registers a sesison
variable, Page 2 tries to then print out the session variable...
Sorry if its obvious but I have stripped down my previously working
code to just these few lines and still cannot fathom where the error
lies.
Simple. BUT IT WON'T WORK! PLEASE PUT ME OUT OF MY MISERY!
Page 1:
<?php
session_start() ;
session_registe r("test");
$_SESSION["test"] = "Hello World";
?>
<a href='check_tes t.php'>Check Test</a>
Page 2:
<?php
if ( session_is_regi stered("test") == true ) {
print "test is a registered session variable";
} else {
print "test is NOT a registered session variable";
}
?>
<br/>
<?php
print "test is " . $_SESSION["test"];
?>
<br />
<a href='set_test. php'>Set Test</a>
Thanks,
Rick
the weekend but I just cannot get sessions working!
Anyway - two pages. Page one starts session and registers a sesison
variable, Page 2 tries to then print out the session variable...
Sorry if its obvious but I have stripped down my previously working
code to just these few lines and still cannot fathom where the error
lies.
Simple. BUT IT WON'T WORK! PLEASE PUT ME OUT OF MY MISERY!
Page 1:
<?php
session_start() ;
session_registe r("test");
$_SESSION["test"] = "Hello World";
?>
<a href='check_tes t.php'>Check Test</a>
Page 2:
<?php
if ( session_is_regi stered("test") == true ) {
print "test is a registered session variable";
} else {
print "test is NOT a registered session variable";
}
?>
<br/>
<?php
print "test is " . $_SESSION["test"];
?>
<br />
<a href='set_test. php'>Set Test</a>
Thanks,
Rick
Comment