Checkbox Problem..

A

Anonymous

Guest
you need to use the ' char in your details...

echo "<INPUT NAME='checkbox' TYPE='checkbox' VALUE='checkbox' CHECKED>";

Andrew
 
Where is the $x->show_email value coming from? Echo it; is it what you expect it to be?

And the correct syntax for a checked checkbox is:
Code:
<input name="checkbox" type="checkbox" value="checkbox" checked="checked" />

It would do you well to review your XHTML.

Also, purely subjectively, it seems like a poor idea to have both the name and the value as "checkbox".
 
Try doing the following:
if ($x->show_email==1) {
echo "<input type='checkbox' name='opt_mail' CHECKED>";
} else {
echo "<input type='checkbox' name='opt_email'>";
}
 
Back
Top