I am trying to find a method to execute some PHP code once a user closes the page. In my application, once the user closes or navigates away from the page the server will st
If you can use Javascript and JQuery, use 'window.onclose' and then an Ajax call to do whatever you want using PHP:
Capture event onclose browser
// Javascript code window.onclose = closing; function closing(){ $.ajax({ url: 'yoururl.php', data: yourdata, success: function(content){ // empty } }) }