mercredi 11 février 2015

Keep checkbox checked AND only check 1 checkbox per group

I'm looking to combine two things:


a) ensure that when a checkbox is checked, it remains checked after submit, AND


b) only allow one checkbox per group (e.g. the one below) be allowed to be checked at once. I can't use radio buttons unfortunately!


I can do a) & b) in isolation but unfortunately can't seem to combine them! Please help?



<form>
<input type="checkbox" name="a" value="low" <?php if(isset($_POST['a'])) echo "checked='checked'"; ?>/>
<input type="checkbox" name="b" value="mid" <?php if(isset($_POST['b'])) echo "checked='checked'"; ?>/>
<input type="checkbox" name="c" value="hi" <?php if(isset($_POST['c'])) echo "checked='checked'"; ?>/>
</form>




Aucun commentaire:

Enregistrer un commentaire