Page 1 of 1

Checkbox Help

Posted: Tue Dec 30, 2003 1:22 pm
by AliasBDI
I have looked at the other threads regarding checkboxes but found none which assist me. I have an update form which displays a user's information and allows them to change. One thing to change is the subscription status. If "yes" they check the box and if "no" they uncheck it. Here is the code I have so far:

Code: Select all

<input type="checkbox" name="newsletter" value="1"   <?php echo checked($newsletter == "1") ?>>

Posted: Tue Dec 30, 2003 1:32 pm
by microthick
how about:

<input type="checkbox" name="newsletter" value="1" <?php if ($newsletter == "1") echo "checked=\"checked\"" ?>>

super

Posted: Tue Dec 30, 2003 1:41 pm
by AliasBDI
That did it! Thanks.