PHP Sessions and redirecting
===

    <?php require_once('./includes/connection.php'); ?>
    <?php require_once('./includes/sql_func.php');?>
    <?php 
    	if(isset($_POST['submit']))
    	{
    		$isValid = verify_account($_POST['username'],$_POST['password']);
    		if($isValid){
    			session_name($_POST['username']);
    			session_start();
    			$_SESSION['isLoggedIn'] = true;
    			session_write_close();
    			redirect_to("user_panel.php");
    			
    		}else{
    			echo "Invalid Username and password";
    		}
    	}
    ?>
    <?php require_once('./includes/header.php');?>

Assuming that the user has entered a valid username and password it will create a session variable and will store different values in the session array. but how come when I redirect a user to another page the

    <?php require_once('./includes/connection.php'); ?>
    <?php require_once('./includes/sql_func.php');?>
    <?php 
    	session_start();
    ?>
    <?php require_once('./includes/header.php');?>
    	<?php 
    		if(isset($_SESSION['isLoggedIn'])){
    			echo "Hello User";
    		}
    	?>
    
    <?php require_once('./includes/footer.php');?>

 This Line on the code above 
   

     isset($_SESSION['isLoggedIn'])

is not being read as true?