[thelist] passing a non-form value into an array in php

DESCHAMPS Stéphane DvSI/SICoR stephane.deschamps at francetelecom.com
Wed Oct 30 03:42:01 CST 2002


> -----Message d'origine-----
> De : thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]De la part de .jeff
> rather than rely on php's built-in "feature" of converting
> form fields that
> end with [] into arrays, i'd find a way to reliably name each
> of the fields
> individually to prevent this list creation upon submission.

Maybe simply incrementing a $i of some sort like such:
<? var $i=0; ?>
<input id="foo[<? echo $i++; ?>]">
<input id="foo[<? echo $i++; ?>]">
...

Then for the browser you have unique identifiers (foo[0], foo[1]) and can
access them through JS (hopefully, but I haven't tried), and yet take
advantage of the array feature for the server-side processing.

What do you think?




More information about the thelist mailing list