2021年4月11日星期日

$_SESSION isn't working when calling from another page

I am just trying to get session to work before implementing it into my code and can't seem to get it to. It's very basic and followed the code from w3 schools as well as looked up why it wouldn't work, but everything I find shows that it should work.

Where I set $_SESSION (test1.php)

<?php     session_start();     $_SESSION["test"] = "test";     echo $_SESSION["test"];  ?>  

Where I call $_SESSION (test2.php)

<?php     session_start();     echo $_SESSION["test"];  ?>  

Error I Receive

Undefined index: test in /home/hhw56gndsib6/public_html/test/test2.php on line 3

https://stackoverflow.com/questions/67051552/session-isnt-working-when-calling-from-another-page April 12, 2021 at 09:06AM

没有评论:

发表评论