GB_001 Posted January 11, 2008 Share Posted January 11, 2008 I was wondering if there is anyway to call a php function to change a variable one the user closes the page or tab? Thankyou for your help. -GB Quote Link to comment https://forums.phpfreaks.com/topic/85574-changing-a-variable-when-window-is-closed/ Share on other sites More sharing options...
nikefido Posted January 11, 2008 Share Posted January 11, 2008 change a variable? they cease to exist when you close a page do you mean a static variable in a class or included file? Or a database record? ... I would use javascript, as it can do events when you close a window - this would be an ajax use (if you are trying to run a php script when the window closes). However, if you want some data stored that's not on a web page, you need to use a separate file (.txt file) or a database... What are you trying to accomplish? Quote Link to comment https://forums.phpfreaks.com/topic/85574-changing-a-variable-when-window-is-closed/#findComment-436703 Share on other sites More sharing options...
GB_001 Posted January 11, 2008 Author Share Posted January 11, 2008 I was storing the variable in a database, what I was trying to accomplish was solving a problem in my chat script for when the user closes the window the chat databases inactivity var in the database goes to one. Quote Link to comment https://forums.phpfreaks.com/topic/85574-changing-a-variable-when-window-is-closed/#findComment-436714 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.