Session is not working even using correct format why? : I am using PHP script where when I add session it is not working, that's causes I am unable to unable to pass data from one page to other.

What I do? Even All tags is right opened and closed.
Please help...Where is my mistake, why I unable to pass data from one page to other.?
Why I am unable to login and redirect to logout page .

I am using this script.

        

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

    <!DOCTYPE html>
    <html lang="en-US">
    <head>
    <title>MyWebsite</title>
    <meta charset="utf-8"/>
    <META http-equiv="Content-Type" content="text/html; charset="utf-8">
    <META http-equiv="Content-Style-Type" content="text/css">
    <META Http-Equiv="Cache-Control" Content="no-cache">
    <META Http-Equiv="Pragma" Content="no-cache">
    <META Http-Equiv="Expires: Thu, 01 Dec 2018 16:00:00 GMT" Content="0">
    <meta name="viewport" content="user-scalable = 0, width=device-width, initial-scale=1.0" />

    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
    <link type="text/css" rel="stylesheet" href="/style1.css"/>
    </head>
    <body>
      
    <!-- BEGIN: Sticky Header -->

    <!-- END: Sticky Header -->

    <!-- START: Page Content -->


    <!-- START: Form -->
    <div class="box">
          
          <div class="row">
          <div class="logo-row">
          <img src="/images/login-icon.png" title="Login" alt="Please Login Here" class="logo"/>
         </div>
         </div>
         
      <?php
            //connect to db
            $con = mysqli_connect("localhost", "user", "pass", "db") or die(mysqli_error());
      ?>
      
          <?php echo $message1; ?>
          <?php echo $message2; ?>
        
                
    <form method="POST" action='<?php echo $_SERVER['PHP_SELF']; ?>' enctype="multipart/form-data">
               
               
    <p class="inp-wrap">

    <div class="ico icobg">
    <input type="text" class="inp clearable" name="username" placeholder="Username." Value="" maxlength="10" minlength="10"  />
    <i class="fa fa-user fa-lg fa-fw" aria-hidden="true"></i>
    </div>

    </p>

    <p class="inp-wrap">
    <div class="ico icobg">
    <input class="inp clearable" type="password" name="Password"  placeholder="Enter your password" minlength="06" 	/>
    <i class="fa fa-lock fa-lg fa-fw" aria-hidden="true"></i>
    </div>
    </p> 

    <div>
         <label for="re" style="font-weight: normal; font-size:13px;">
            <input id="re"  type="checkbox" value="active" name="remember"/>Remember me
         </label>
    </div>      
            
    <p class="inp-wrap">
    <input class="sendbtn" type="submit" value="LogIn" name="submit"/>
    </p>

    </form>


    </div>    
    <!-- END: Form -->  

    <?php
            if(isset($_POST['submit'])){
                $Username = $_POST['Username'];
                $Password = $_POST['Password'];
                 
                if(empty($Username) OR empty($Password)){
                
                 
               $message1= '
                 <h3>All fields are required for  login.</h3>';

                exit();
                }
     
                //check remeber me button is set or not
                if(isset($_POST['remember'])){
                    $remember = "active";
                }else{
                    $remember = ""; 
                }
     
                //check username and pass
                $query = mysqli_query($con,"SELECT * FROM `login` WHERE Username='$Username' AND Password='$Password'");
     
                if(mysqli_num_rows($query) == 1){
     
                    //login the user in
                    if($remember == "active"){ //remember me checked
                        setcookie("Username",$Username,time() + (86400  * 10));
                    }else{ //remember me not checked
                        session_start();
                        $_SESSION['Username'] = $Username;
                    }
     
                    echo "user logedin";
                    header("Location: index.php");
                    exit();
                }
                    
               $message2= '
                  <h3>Invalid Credentials.</h3>
                  ';
                  
                exit();
     
            }
        ?>
        
    <!-- END: Page Content -->

    <!-- BEGIN: Sticky Footer -->

    </body>
    </html>





<!-- end snippet -->

