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

.jeff jeff at members.evolt.org
Wed Oct 30 03:51:00 CST 2002


> From: DESCHAMPS Stéphane DvSI/SICoR
> > 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.

i still think you're asking for trouble because of the [] in the field name.
maybe part of it is that i get squeamish when something tries to convert
simple values into complex values for me when they couldn't possibly be
anything but simple values from the browser.


jeff at members.evolt.org

More information about the thelist mailing list