title: PHP session problems
body: <p>I am using the following code to invalidate the session. I have linked to <code>logout.php</code> in many pages. If that logout link is clicked the <code>logout.php</code> page is called. The  following is the code in <code>logout.php</code>.</p>
  
  <pre><code>unset($_SESSION['admin']);
  session_destroy();
  header('Location: index.php');
  </code></pre>
  
  <p>Once the session is invalidated I want to open the page <code>index.php</code>.
  But I am geting the following error:</p>
  
  <blockquote>
    <p>Warning: session_destroy() [function.session-destroy]: Trying to destroy uninitialized session in C:\xampp\htdocs\Selection\logout.php on line 3</p>
    
    <p>Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\Selection\logout.php:3) in C:\xampp\htdocs\Selection\logout.php on line 4</p>
  </blockquote>
  
  <p>What is wrong?</p>