Jump to content

Change or remove a variable on click


eckul

Recommended Posts

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

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/283711-change-or-remove-a-variable-on-click/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.