title: Creating javascript function to destroy php session
body: <p>I am having trouble figuring out how to create a javascript function that will destroy a php session.  I have a clickable link that will call a function called destroyphpsess.  I think this is all right so far.  Now I need to define the javascript function.  This is the code I have so far...</p>
  
  <pre><code>if ($_SESSION['color'] == "") {
      $var = "&lt;a href='JavaScript:newPopup(\"http://www.yourfantasyfootballreality.com/register.php\");' class='two'&gt;Register&lt;/a&gt; | &lt;a href='JavaScript:newPopup(\"http://www.yourfantasyfootballreality.com/signin.php\");' class='two'&gt;Sign In&lt;/a&gt;";
  } else {
      $var = "Hello, ".$_SESSION['color'] ."! | " . "&lt;a href=\"http://www.yourfantasyfootballreality.com/index.php\" onclick=\"destroyphpsess()\" class='two'&gt;Log Out&lt;/a&gt;";
  }
  echo $var;
  </code></pre>
  
  <p>Now I need to define the javascript function.  This is where I am having trouble.  This is the basic outline I have so far...</p>
  
  <pre><code>function destroyphpsess()
  {
  &lt;?php
  session_destroy();
  ?&gt;
  }
  </code></pre>
  
  <p>If someone could help me with the function I would appreciate it!
  Thanks.</p>