Bastien Koert wrote:
I use this format
<input name="right_eye" type="checkbox" value="1" <? if
($rows['right_eye']==1) { echo " CHECKED "; } ?>> 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 assume
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" />
Bastien
From: Mark Benson <markbenson@xxxxxxx>
To: php-db@xxxxxxxxxxxxx
Subject: 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
MSN - mark.benson@xxxxxxxxxxxxx
Visit FlatPackMacs online: <http://fpm.68kmac.com>
Visit my Homepage: <http://homepage.mac.com/markbenson>
"Introducing Macintosh Classic II - pick one out on your way past the
trash!"
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php