And if you want to check if a logged in user has a no too then use the following code model <?php declare (strict_types = 1); (array) $_FakeSESSION = ['id' => 1, 'salecheck'=> 'yes']; if (!isset($_FakeSESSION['id']) || !empty($_FakeSESSION['salecheck']) && $_FakeSESSION['salecheck'] === 'no') {     header('Location: nosale.php');     exit; } echo 'this is the YES page view.'; ?> what we are doing is better if we read it to ourselves. if session id is not set OR