[thelist] Phorm and Checkboxes

sasha thelist at lists.evolt.org
Mon Jan 6 14:33:03 2003


On Mon, 06 Jan 2003 12:11:01 -0800, Anthony Baker <lists at thinkbigideas.comwrote:

> The code I'm using is:
>
> <input type="checkbox" name="question_01" value="item 1" />item 1
> <input type="checkbox" name="question_01" value="item 2" />item 2
> <input type="checkbox" name="question_01" value="item 3" />item 3
> <input type="checkbox" name="question_01" value="item 4" />item 4
> <input type="checkbox" name="question_01" value="item 5" />item 5
>

Because they all have the same name?  $question_01 = 'item 1' is being
overwritten by $question_01 = 'item 2'.  They should only have the same
name if they're radios, not checkboxes.  The basics of forms.

If they must be tied to question_01, your only option is to name it
name="question_01[]", and then it will be an array of 'item 1', 'item 2',
etc.  But, you'll have to go in and edit whatever processes that
information so that it can handle arrays.

--
sasha