Bastien Koert wrote:
I use this format

<input name="right_eye" type="checkbox" value="1" <? if ($rows['right_eye']==1) { echo " CHECKED "; } ?>>&nbsp;Right Eye(s)

if your into XHTML:

<input name="right_eye" type="checkbox" value="1" checked="checked" value="1" />

(Bastien already showed how to dynamically determine whether the chkbox is 
checked :-)

... all attribs in lower case, and every one must have a value set, in the case
of the 'checked' attrib the value is 'checked'. I haven't tried it out but I 
the following html would result in an unchecked box - I also imagine that that
may depend on the DOCTYPE of the output page - and I may just be plain wrong :).

<input name="right_eye" type="checkbox" value="1" checked="" value="1" />


From: Mark Benson <[EMAIL PROTECTED]>
Subject: [PHP-DB] Forms...
Date: Wed, 9 Mar 2005 19:12:31 +0000

Does anyone know if it is possible to have 'checkbox' elements in a form appear 'checked' or 'unchecked' when a page loads data from a MySQL data source? Can I use an attribute in the <input> tag to switch that?
Mark Benson

AIM - SilValleyPirate
Visit FlatPackMacs online: <>
Visit my Homepage: <>

"Introducing Macintosh Classic II - pick one out on your way past the trash!"

PHP Database Mailing List (
To unsubscribe, visit:

-- PHP Database Mailing List ( To unsubscribe, visit:

Reply via email to