Using Check Boxes

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
newphper
Forum Commoner
Posts: 26
Joined: Mon Mar 21, 2011 1:48 am
Location: Bridgeman Downs, Qld, Australia

Using Check Boxes

Post by newphper »

I have a snippet of code here that is "the same but different".

What would be the difference do you think ?

The VALUE="yes" is placed differently for some reason ......? To have a checkbox checked by default maybe ??

Code: Select all

<INPUT TYPE=CHECKBOX NAME="intelligent" <?php if($row['intelligent']=='yes'){echo "CHECKED";}?> VALUE="yes">Intelligent<BR />
<INPUT TYPE=CHECKBOX NAME="shy" <?php if($row['shy']=='yes'){echo "CHECKED";}?> VALUE="yes">Shy at first<BR />
<INPUT TYPE=CHECKBOX NAME="family_oriented" VALUE="yes" <?php if($row['family_oriented']=='yes'){echo "CHECKED";} ?>>Family oriented<BR />
<INPUT TYPE=CHECKBOX NAME="healthy_lifestyle" VALUE="yes" <?php if($row['healthy_lifestyle']=='yes'){echo "CHECKED";} ?>>Healthy lifestyle<BR />
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Using Check Boxes

Post by AbraCadaver »

newphper wrote:I have a snippet of code here that is "the same but different".

What would be the difference do you think ?

The VALUE="yes" is placed differently for some reason ......? To have a checkbox checked by default maybe ??
I have no idea what you mean by placed differently. What exactly is the problem?
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Using Check Boxes

Post by social_experiment »

newphper wrote:The VALUE="yes" is placed differently for some reason ......? To have a checkbox checked by default maybe ??
If you are refering to the position of 'value="yes"' within the tag: No, that doesn't determine whether the box is checked. The php code wrapped up in the input tag does.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply