title: Some problems with PHP sessions
body: <p>I'm setting a session variable in one page and doing it echo in another page but there isn't any output in the second page.</p>
  
  <h2>page1.php</h2>
  
  <pre><code>&lt;?php 
      session_start();
      $_SESSION['id'] = 1;
      echo $_SESSION['id'];
      header("Location: page2.php"); //redirecting to page2.php
  ?&gt;
  </code></pre>
  
  <h2>output of page1.php</h2>
  
  <pre><code>1
  </code></pre>
  
  <h2>page2.php</h2>
  
  <pre><code>&lt;?php
      session_start();
      echo " $_SESSION['id']" ; 
  ?&gt;
  </code></pre>
  
  <h2>output of page2.php</h2>
  
  <pre><code> no output
  </code></pre>
  
  <p>Why this happens and what to do get the output in page2.php as 1 ??</p>