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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.