- Impact
- 0
I have a bit of a problem and I cant figure it out. I want to execute a php function when a link is clicked. I have tried to do this by using the code below. But every time a load the page containing the link it executes the function, instead of executing only when it is clicked.
Function code which is used to destory the session.
Any help would be great!!
PHP:
echo "<a href='login.php' onClick=".logOut()."><img src=icon/exit.gif border='0'><br>Log Out</a>";
Function code which is used to destory the session.
PHP:
function logOut(){
session_unset();
session_destroy();
}
Any help would be great!!