[pmwiki-users] multiple values for a single form element
Ben Stallings
Ben at InterdependentWeb.com
Thu Aug 24 18:00:49 CDT 2006
Note: this appears to be a PHP issue, but it affects PmWiki, so I
thought some of you might have some insight to share.
I've been working on a pretty complex database front-end for a client,
using my UpdateForm recipe. One limitation I've run into is that
although I can create a form where a single form element has multiple
values -- for example a set of checkboxes with the same name or a select
box with the "multiple" parameter turned on -- and although these values
do in fact get submitted with the form, they don't seem to be accessible
to PHP.
For example, if my form contains
(:input checkbox potato yellow:)Yellow (:input checkbox potato red:)Red
and both boxes are checked and the form is submitted via method=get, the
data string will look like
?potato=yellow&potato=red
but $_GET['potato'] will be 'red'. The first value appears to be
overwritten by the second. The reason this puzzles me is that I used to
write in Embedded Perl (which is similar to PHP) years ago and was able
to access that information as an array... and we've all filled out forms
online that allowed multiple rows to be selected in a select box, so
clearly someone is able to make it work. And the reason it matters is
that it's the easiest way to get data into and out of a SET datatype in
MySQL.
Do any of you happen to know offhand if there's a way to allow the $_GET
and $_POST variables to retain multiple submitted values with the same
name? Maybe it's some sort of PHP setting I'm unaware of. Or perhaps
there's another way to access that information besides
$_GET/$_POST/$_REQUEST? Thanks in advance! --Ben
More information about the pmwiki-users
mailing list