dimanche 21 juin 2020

can i set checked or unchecked checkbox reading a string value?

I have a string $str that should value 1 or 0 and a checkbox. When i read the string value i want to set the checkbox checked if $str value is 1 or unchecked if $str value is 0.

<?
    if ($str == 1){
        // checkbox checked                                                     
    } else {
        // checkbox unchecked                                                           
    }
?>  
<input type='checkbox' name='nome_posiz[]' />



Aucun commentaire:

Enregistrer un commentaire