0

I have been working is a website I have been dealing with a problem from a while, and now I know why it is happening, but not how to solve it. Please help!!

Step 1 In the first page, login page set the $_SESSION['user_id'] is stored the value that are fetch in database user id . it was working properly and also I print the session value in same page.and also navigate the next page.

Step 2 the next page is user home page, but in this page session variable is empty This works perfectly most of the times,but in a few cases the session variable is empty in the next page, even when

1 Answers1

0

You probably forgot to call session_start(); either on the homepage, on the login page or on both. You'll need to call it in every page you need it, to make the sessions variables available.

Erick Mota
  • 69
  • 2