mardi 4 avril 2017

selected checkbox remain checked/unchecked after form submission

I have this simple checkbox.

My problem is, if I select any of the checkbox, it should remain checked after form submission.

<input type="checkbox" name="services" value="make-up"> Make-up <br>
<input type="checkbox" name="services" value="massage"> massage <br>
<input type="checkbox" name="services" value="haircut"> Haircut <br>

I tried this code from radio button hoping to work but I failed.

<?php if (isset($services) && $services=="make-up") echo "checked";?>

I learned that it will work using localstorage.. however all the example I saw is very complicated.

Is there a simple way to solve this?

Thanks.




Aucun commentaire:

Enregistrer un commentaire