PDA

View Full Version : Checkbox problem



Dhuan
Mar 28th, 2009, 10:08 PM
<form>

In my body, there are...<br>
<input type=checkbox name=body value=arms>...arms<br>
<input type=checkbox name=body value=legs>...legs<br>
<input type=checkbox name=body value=hands>...hands<br>
<input type=checkbox name=body value=fingers>...fingers<br>
<input type=submit>

</form><P>


Result: <?=$_GET[body] ?>

Alright, what I want to know is, what's the use of having the checkbox if the value will only be the last checked?
I wonder if I made myself clear enough.
You see, the checkbox is supossed to work so you can have multiple options selected, but that's not what it happens here...

djm0219
Mar 28th, 2009, 10:12 PM
Name them differently or, if you're going to be using PHP, name them as body[] which will make their values available in the body array when you are processing the page with PHP.

RomanTaylor
Mar 29th, 2009, 01:46 AM
<form>

In my body, there are...<br>
<input type=checkbox name=body value=arms>...arms<br>
<input type=checkbox name=body value=legs>...legs<br>
<input type=checkbox name=body value=hands>...hands<br>
<input type=checkbox name=body value=fingers>...fingers<br>
<input type=submit>

</form><P>



It overwrites itself.