title: Why is the session value empty?
body: <p>I have odd problem with session value. Here is my code:</p>
  
  <pre><code>      &lt;?php
  session_start();
  if ((isset($_POST['potvrda'])) &amp;&amp; ($_POST['potvrda'] === "potvrda")){
                  $karte  = new karte($cijene[0]['jednosmjerna'], $cijene[0]['dnevna'], $cijene[0]['rijeka_jedna'], $cijene[0]['rijeka_pov'], $db);
                  $data   = $karte-&gt;validate_form();
                  $_SESSION['form_sub_data'] = array (
                                'datum' =&gt; $data[0][1]['date'],
                                'povratak' =&gt; $data[0][1]['datum_pov'],
                                'ime' =&gt; $data[0][1]['name']);
  
      if((empty($data[0][0])) &amp;&amp; (!empty($_SESSION['form_sub_data']))){
                header("Location: " .SERVER ."purchase");
                die();
                }
      }
  </code></pre>
  
  <p>What it does is this: it checks if all form fields are filled propperly (class karte), my class returns array <code>$data[0][0]</code> that contains erros and <code>$data[0][1]</code> with proper values. Then I set all data from array <code>[0][1]</code> to <code>$_SESSION</code>, and if I <code>var_dump()</code> that session it's all there. Problem is after redirect. my <code>$_SESSION</code> is empty for some reason on second page. </p>
  
  <p>On second page i have this code: </p>
  
  <pre><code>session_start();
  
  if(empty($_SESSION['form_sub_data'])){header("Location: ".SERVER."");}
  </code></pre>
  
  <p>Now problem gets even more strange. Second page recives empty <code>$_SESSION</code>, it returns me to previous page, but when i fill form again. It all works as intended. </p>