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...
if ($_SESSION['color'] == "") {
$var = "<a href='JavaScript:newPopup(\"http://www.yourfantasyfootballreality.com/register.php\");' class='two'>Register</a> | <a href='JavaScript:newPopup(\"http://www.yourfantasyfootballreality.com/signin.php\");' class='two'>Sign In</a>";
} else {
$var = "Hello, ".$_SESSION['color'] ."! | " . "<a href=\"http://www.yourfantasyfootballreality.com/index.php\" onclick=\"destroyphpsess()\" class='two'>Log Out</a>";
}
echo $var;
Now I need to define the javascript function. This is where I am having trouble. This is the basic outline I have so far...
function destroyphpsess()
{
<?php
session_destroy();
?>
}
If someone could help me with the function I would appreciate it! Thanks.