eckul Posted November 8, 2013 Share Posted November 8, 2013 Hi I've got a simple php variable $a = 100; I have a button with id = "month" When the button is clicked I want to change the variable to $a=0; this variable is used multiple times on the page. Another alternative would be to remove the variable all together on click of the button. either option would be ok for what I want. Any help would be great. thankyou Quote Link to comment https://forums.phpfreaks.com/topic/283711-change-or-remove-a-variable-on-click/ Share on other sites More sharing options...
requinix Posted November 8, 2013 Share Posted November 8, 2013 As long as you're talking about reloading the page with the effects of having $a=0, 1. Name the button. Not an id but a name. 2. Look in $_GET or $_POST (depending on the form method) for the presence of the button. That indicates it was clicked. 3. If present, set $a=0. Try that out in your code. If you have problems or questions, post what you have and what's wrong. Quote Link to comment https://forums.phpfreaks.com/topic/283711-change-or-remove-a-variable-on-click/#findComment-1457491 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.