Session variable never through the pages

I have a problem with my website. I am using a free plan.

I start a session at the beginning of every page but the variable $_SESSION is null and i get the error message “undefined key “username” on line” that refer to $_SESSION[“username”]
when I troubleshoot the problem and see the content of the $_SESSION array in each page, I found it created successfully and stored the variables on the same page but when redirected to another page the variable was exciting without any key or value on it.

I think my problem is the same as this one on the link below

I don’t think you problem is the same as what was listed in that other topic. That issue was a session storage issue following a PHP upgrade. But that was fixed shortly after, so that can’t be the exact same issue.

That said:

Which website is that exactly? If you want someone to check the session storage of your website, please tell us which website that is. If you can tell us how to reproduce this issue on your website, that would be even better.

1 Like

that is my website: http://jasakoda.kesug.com/
first, it open login page
the user should login in and the username store in the session using this line in php file $_SESSION[“username”] = $username;
and after the authentication process success, the website will redirect the user into home page and on the header there is a field to show the current username using this line below
<?php echo $_SESSION['username']; ?>
but this error message show :
Warning : Undefined array key “username”

I don’t know how but it solved.
before I send the first reply, it was showing me the error
but now it works.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.