title: Notice: undefined index with session global
body: <p>I was adding a multi-language system to my website, but came accross this error. Everytime I try to set some value on my $_SESSION, it says</p>
  
  <pre><code>Notice: Undefined index: lang in ...\pages\lang.php on line 3
  </code></pre>
  
  <p>What I noticed, is when I'm trying to set the $_SESSION on my core file, it works, but if I'm trying to include the file which sets the session to the core file, it throws out that error. Here's the snippet of core.php:</p>
  
  <pre><code>&lt;?php
  session_start();
  //some code
  //if I type $_SESSION['lang'] = 'smth'; here, it will work
  if (!isset($_GET['page']) || $_GET['page'] == "" || !file_exists('pages/'.$_GET['page'].'.php')) {
    include 'pages/home.php';
  } else {
    include 'pages/'.$_GET['page'].'.php';
  }
  ?&gt;
  </code></pre>
  
  <p>pages/lang.php:</p>
  
  <pre><code>&lt;?php
  $lang = $_GET['lang'];
  $_SESSION['lang'] == $lang;
  var_dump($_SESSION); //prints an empty array ( array { } )
  //header("Location: index.php");
  ?&gt;
  </code></pre>
  
  <p>Any ideas? Thank you.</p>