CBR Posted May 23, 2008 Share Posted May 23, 2008 I want to execute a query when someone clicks on any menu items that will exit to another part of a site. Is this possible? Quote Link to comment https://forums.phpfreaks.com/topic/106992-execute-action-with-php-when-a-link-to-leave-a-page-is-clicked/ Share on other sites More sharing options...
BlueSkyIS Posted May 23, 2008 Share Posted May 23, 2008 you'd need to write a javascript (Ajax) function that would communicate with the server. add that function to the onclick() action of the links/buttons. Quote Link to comment https://forums.phpfreaks.com/topic/106992-execute-action-with-php-when-a-link-to-leave-a-page-is-clicked/#findComment-548413 Share on other sites More sharing options...
.josh Posted May 23, 2008 Share Posted May 23, 2008 ^ right. PHP is parsed on the server and then sent to the client, so you need a client-side script to do something like that. Alternatively, depending on what exactly you're trying to accomplish (in relation to your content), you could possibly setup a condition or something to check something or other and run the query at the beginning of the destination page(s). Quote Link to comment https://forums.phpfreaks.com/topic/106992-execute-action-with-php-when-a-link-to-leave-a-page-is-clicked/#findComment-548416 Share on other sites More sharing options...
CBR Posted May 27, 2008 Author Share Posted May 27, 2008 I am locking records in a database by setting a flag. I want the record to be unlocked if for some reason the editor/submitter clicks on any other buttons that leave a page. Quote Link to comment https://forums.phpfreaks.com/topic/106992-execute-action-with-php-when-a-link-to-leave-a-page-is-clicked/#findComment-550787 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.