I have a login page that sets a $_SESSION['usertype'] when I log in. I have a separate PHP file that contains a menu that loads on the side. That file is loaded on every PHP file through
<?php include('menu.php') ?>
But when I check for $_SESSION['usertype'] in menu.php, it is not set.
Why is this?
Just checking whether you’re using session_start() before you include the file which needs to access
$_SESSION['usertype']?Have a check through this tutorial.