I need to make a link that when clicked will run this in php:
session_destroy();
I know how to make a link in html, but I don't know how to make it interact with php. Thanks for any help.
For an example, you want to use this script for logging out.
Your HTML has to be something like this for "index.php" (just an example)
<a href="logout.php">Log Out</a>
Then on the "logout.php"
session_start(); //to ensure you are using same session
session_destroy(); //destroy the session
header("location:index.php"); //to redirect back to "index.php" after logging out
exit();
In case you want to use JavaScript, I can tell you that too?
all you need to do is call a PHP script, which calls that function.