$_SESSION variable not saving on page refresh or new page


So I have a form that allows the user to select a city. Once selected, this city is then saved to a $_SESSION variable as such : $_SESSION['city_selected'] = $_POST['location_select'];

This works fine once selected. When I var_dump($_SESSION); I see my variable perfectly on after selecting the city and the page refreshing.

Then, if I move to a different page or refresh the same page – the var_dump(); returns NULL

I can’t seem to figure this out. My PHP session ID doesn’t change.

I am using WAMP on a local server, and session files are saving in the tmp folder.

Am I missing something? What the heck is happening?

, , , Charlie C 7 months 0 Answers 92 views 0

Leave an answer