title: logout php session using javascript
body: <p>I'm trying to logout of a php session using javascript.  It doesn't work - the javascript function is called and the if statement works, but the php script isn't called.  Is there a better way to do it?  I am using a .php page.</p>
  
  <pre><code>function logoutck() 
      {
      var r = confirm("Do you really want to log out?");
      if (r==true)
          {
          &lt;?php
          session_start();
          session_destroy();
          header('Location: login.php');
          ?&gt;
          } 
      }
  </code></pre>