in reply to Input arrays to CGI

if you just name them all the same thing "name='item'" then when you do $q->param('item'); you will get a reference to a list containing all the values (no clue what order tho)

Replies are listed 'Best First'.
Re: Re: Input arrays to CGI
by sedhed (Scribe) on Jul 24, 2002 at 07:24 UTC
    I haven't used that functionality. Nice. Upon inspection though, I see that when called in scalar context, param('list') returns the first item only. In list context it works, returning an array of the values of all fields named 'list'.
    http://localhost/somefile.cgi?list=1&list=2&list=666 $list = param('list'); # $list is 1 @list = param('list'); # @list is (1, 2, 666)

    With a list of checkboxes though, say for delete selection in a data table, I'd still have to use the map {/list_(.*)/}, param() trick, because I'd have to know which fields are checked.

    Thanks for pointing that one out BUU