php and check boxes

hi all does anyone know how to keep a checked check from unchecking after php form is submitted

Pretty simple actually. Just use an if statement. have it look at the value of the checkbox, if its checked, have it echo “checked = ‘checked’”

something like (outside the php tags of course, if its inside, just remove the php tags)
<input type=“checkbox” name=“a” value=“1” <?php if($_POST['a'] == 1) echo "checked = 'checked'"; ?> />

Hope it helps :slight_smile:

thank you worked a treat :0)

Sponsor our Newsletter | Privacy Policy | Terms of Service