Page 1 of 1

Using Check Boxes

Posted: Thu Jul 07, 2011 12:05 am
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 />

Re: Using Check Boxes

Posted: Thu Jul 07, 2011 10:15 am
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?

Re: Using Check Boxes

Posted: Thu Jul 07, 2011 11:52 am
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.