dimanche 20 novembre 2016

change variable when condition is true in php

I want to change the value of my variable when a checkbox is checked so i created a checkbox in html :

<input type="checkbox" name="checkbox1" >Cena</>

Then i write a little code in php, that normaly when the checkbox is checked the value of the variable have to change :

$var = "value2";
if (isset($_POST['checkbox1'])){
                $var = "value1";
        }

But this code don't work and i really don't now why.

Aucun commentaire:

Enregistrer un commentaire