title: PHP variable getting overwritten
body: <p>Well, I am currently trying to write code which checks if a twitch stream is live or not. To do so I have created the array <code>$_SESSION['errors'];</code> On the second <code>.php</code> <code>$_SESSION['errors']</code> is either given 'live' or 'Not live', however whenever it goes back to the first <code>.php</code> page the <code>$_SESSION['errors']</code> will be overwritten at the point it was defined.</p>
  
  <p>My question is, how, if possible would I get around this issue.</p>
  
  <p>Code:</p>
  
  <p>PHP in index.php:</p>
  
  <pre><code>&lt;?php
  $_SESSION['errors'] = '';
  echo $_SESSION['errors'];
  ?&gt;
  </code></pre>
  
  <p>PHP from streaminfo.php:</p>
  
  <pre><code>&lt;?php
      if (empty($_POST) === false) {
          header('Location: index.php');
      }
      $streamer = $_POST['username'];
      $apiurl = "https://api.twitch.tv/kraken/streams/" . $streamer;
      $apicontent = file_get_contents($apiurl);
      $streamerinfo = json_decode($apicontent);
  
              if ($streamerinfo-&gt;stream == '') {
                  echo '&lt;h2&gt;' . 'Streamer is not live' . '&lt;/h2&gt;';
                  $_SESSION['errors'] = 'not live';
                  header('Location: index.php');
              }
  ?&gt;
  </code></pre>
  
  <p>I realise that I am overwriting the array when <code>index.php</code> is loaded, however I must define it and I dont know what to define it with.</p>