user6568979 user6568979 - 11 months ago 73
PHP Question

Php button handling

I have created a button, now i want to change a variable's value and pass into anothor php file when the button is pressed. I have tried to find some infirmation from google but couldn't find something useful. Can anyone help me to do this?

Answer Source

Lets suppose your button is a link such that

<a href="?set=1">Click here</a>

On click of this button when page would load get the query string parameter like below:

$var = "someValue";
if(isset($_GET['set']) && $_GET['set'] == true){
  $var = "ChangedValue";

and get the val in the other file.