title: $_SESSION variable is lost after redirecting using header function
body: <p>In order to redirect from page 1 to page 2 I've used the header function so :
  I have two files :
  page1.php :</p>
  <pre><code>&lt;?php
  require_once('model/Manager.php');
  
  function login() {
      $user = getUser($_REQUEST['login']);
      if(!empty($user)) {
          if($_REQUEST['login'] == $user['login'] &amp;&amp; $_REQUEST['password'] == $user['password']) {
              $_SESSION['nom'] = $user['login'];
              $_SESSION['user_id'] = $user['id'];
              $_SESSION['articles'] = getArticles($user['id']);
              if($user['role'] == 1) {
                  header('location: view/Administration.php');
                  //require('view/Administration.php');
              }
              else
              require('../view/accueil.php');
          }
          else
              echo 'Erreur Connexion';
  }
  echo 'Merci de vérifier vos données';
  }
  </code></pre>
  <p>And
  Manager.php :</p>
  <pre><code>&lt;?php
  function dbConnect()
  {
      try
      {
          $db = new PDO('mysql:host=localhost;dbname=mini_projet;charset=utf8', 'root', '');
          return $db;
      }
      catch(Exception $e)
      {
          die('Erreur : '.$e-&gt;getMessage());
      }
  }
  
  function getUser($login) {
      $db = dbConnect();
      $req = $db-&gt;prepare('SELECT * FROM utilisateur WHERE login = ?');
      $req-&gt;execute(array($_REQUEST['login']));
  
      $user = $req-&gt;fetch();
      
      return $user;
  }
  
  </code></pre>
  <p>Router.php</p>
  <pre><code>&lt;?php
  require_once('controller/usercontroller.php');
  if (isset($_REQUEST['login']) &amp;&amp; isset($_REQUEST['password'])) {
      session_start();
      login();
  
  }
  </code></pre>
  <p>Page2.php</p>
  <pre><code>&lt;?= session_start(); ?&gt;
  &lt;html lang=&quot;en&quot;&gt;
  &lt;head&gt;
      &lt;title&gt;Administration&lt;/title&gt;
      &lt;script&gt;
          function validateForm() {
              let x = document.forms[&quot;myForm&quot;][&quot;marque&quot;].value;
              if (x == &quot;&quot;) {
              document.getElementById(&quot;marque_validation&quot;).innerHTML = &quot;Merci de remplir ce champ&quot;;
              return false;        
    }
  } 
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
     Bienvenue admin : &lt;?php echo $_SESSION['nom'] ?&gt; 
  &lt;/body&gt;
  &lt;/html&gt;
  
  </code></pre>
  <p>When trying to redirect to page 2 using the header function as mentionned in the code,
  it show me the error : Notice: Undefined index: logged_user in C:\xampp1\htdocs..</p>
  <p>it turns out that the session value is lost, please I need help.
  PS: I read the other questions related to my problem in stackoverflow but there's no solution.</p>