I am using $_SESSION array and on one page when I print array by using print_r($_SESSION); then it displays data, but on the same page when I include another page and that page also have print_r($_SESSION); but don't show any data. Means on the same page it shows data one time and the second time it displays an empty array.
Asked
Active
Viewed 44 times
-1
-
3Did you run `session_start()`? – Phiter Feb 06 '18 at 11:44
-
1sounds like you forgot the `session_start` but would be great to see example pages where it does and does not work as expected – Professor Abronsius Feb 06 '18 at 11:52
1 Answers
1
you should start every page with session_start();

Hamid Vetr
- 111
- 4
-
Thanks for answer But I am including that page in a page where I am using Session again. Like My index.php page have code : print_r($_SESSION); include_once 'Header.php'; On this page, data is showing But in header.php data is not showing – Sunny Feb 07 '18 at 12:07