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.
PHP Code:
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 Code:
function logOut(){
session_unset();
session_destroy();
}
Any help would be great!!