I'm trying to execute some PHP that removes a cookie from your browser (it's used for removing your login data cookie) and when you click on the button called 'Log Out'I tried using an action to do this, but it does not seem to work this way?
<?php
if(isset($_COOKIE['LoggedIn']) && !empty($_COOKIE['LoggedIn'])) {
echo "<li><a href=\"#\" action=\"setcookie(\"LoggedIn\", \"\", time(), \"/\");\">Log Out</a></li>";
} else {
echo "<li><a href=\"login.php\">Log in</a></li>";
}
?>
I am using the '\' to change make the quotes into regular text quotes that can be placed inside the main quotes.
So my question is mainly, how will i achieve executing it correctly? I've tried it this way but it does not do a thing.