ajoo Posted September 28, 2013 Share Posted September 28, 2013 Hi all, I want to know if PHP can handle button clicks like javascript. If i did not wish to use javascript in php is there a way for me to achieve it. Also I would like to know how I may define a static variable whose value 'sticks' unless incremented or decremented specifically . Thanks loads Quote Link to comment https://forums.phpfreaks.com/topic/282493-type-button-onclick-type-of-functionality-for-php-static_variables/ Share on other sites More sharing options...
trq Posted September 28, 2013 Share Posted September 28, 2013 PHP executes on the server, so no. Quote Link to comment https://forums.phpfreaks.com/topic/282493-type-button-onclick-type-of-functionality-for-php-static_variables/#findComment-1451509 Share on other sites More sharing options...
ajoo Posted September 28, 2013 Author Share Posted September 28, 2013 Hi Trq, Thanks. Is that a no to static variables as well? If I cannot use static variables then the only option I see is to use $_SESSION variables. Would that be elegant? I am going back and forth between a form draw and the corresponding code depending upon one of the two buttons pressed. The count of the record is important for both the buttons. When i go thru one routine to the form and back to the routine, i lose variable values? I wonder if this is comprehensible. lol. So I am stuck Thanks Quote Link to comment https://forums.phpfreaks.com/topic/282493-type-button-onclick-type-of-functionality-for-php-static_variables/#findComment-1451512 Share on other sites More sharing options...
trq Posted September 28, 2013 Share Posted September 28, 2013 You cannot use static variables to persist between requests either, no. Quote Link to comment https://forums.phpfreaks.com/topic/282493-type-button-onclick-type-of-functionality-for-php-static_variables/#findComment-1451518 Share on other sites More sharing options...
ajoo Posted September 28, 2013 Author Share Posted September 28, 2013 Hi trg, I am trying to use Session variables. Will let you know if i succeed. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/282493-type-button-onclick-type-of-functionality-for-php-static_variables/#findComment-1451523 Share on other sites More sharing options...
Irate Posted September 28, 2013 Share Posted September 28, 2013 You would have to use <form> elements to handle user input if you do not want to use JavaScript. Quote Link to comment https://forums.phpfreaks.com/topic/282493-type-button-onclick-type-of-functionality-for-php-static_variables/#findComment-1451568 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.