PDA

View Full Version : checkbox array help!!!!


drewamnh
09-27-2002, 07:19 PM
<input type="checkbox" name="task[]" value"16">
<input type="checkbox" name="task[]" value"26">
<input type="checkbox" name="task[]" value"56">


$tasks = $_REQUEST['task'];

print_r($tasks);


but I only get an array that tells me if the checkbox's are on - I need the values???

please help

stuntboy
09-27-2002, 07:46 PM
The array should hold the values, possibly the reason it is not is you are missing = signs between value and the number.

drewamnh
09-27-2002, 07:54 PM
cool

<FORM...>
<INPUT type="checkbox" name="sports[snow]">Snow</INPUT>
<INPUT type="checkbox" name="sports[skate]">Skate</INPUT>
<INPUT type="checkbox" name="sports[surf]">Surf</INPUT>
</FORM>

Submitting this would generate an array, $sports:
[snow] => 'On'
[surf] => 'On'


it seems to work
cheers