[GTALUG] Sending array variable over CGI ?

Alex Beamish talexb at gmail.com
Sat May 12 17:58:40 EDT 2018


Sure, the second way you listed is correct, and the CGI would store each
value for that key into an array.

In that example, you would end up with a Hash of Arrays. In Perl, that
would look like this:

  %params = ( 'A' => [ 111, 222, 333 ] );

Reference material about CGIs is here:


https://metacpan.org/pod/distribution/CGI/lib/CGI.pod#Fetching-the-names-of-all-the-parameters-passed-to-your-script



On Sat, May 12, 2018 at 5:48 PM, William Park via talk <talk at gtalug.org>
wrote:

> Hi all,
>
> If I'm sending single valued data over web, eg. a=111, b=222, c=333,
> then I can do
>     http://.../xxx.cgi?a=111&b=222&c=333
>
> How do I send array data, like A[1]=111, A[2]=222, A[3]=333 to a CGI
> script?  I don't think I can do something like
>     http://.../xxx.cgi?A[1]=111&A[2]=222&A[3]=333
> Or, can I?
>
> I have seen a same variable repeated,
>     http://.../xxx.cgi?A=111&A=222&A=333
> but that means the CGI script has to build the array.
> --
> William Park <opengeometry at yahoo.ca>
> ---
> Talk Mailing List
> talk at gtalug.org
> https://gtalug.org/mailman/listinfo/talk
>



-- 
Alex Beamish

Software Developer / https://ca.linkedin.com/in/alex-beamish-5111ba3
Speaker Wrangler, Toronto Perlmongers / http://to.pm.org/
Baritone, Board Member, Toronto Northern Lights, 2013 Champions /
www.northernlightschorus.com
Certified Contest Administrator, Barbershop Harmony Society /
www.barbershop.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/talk/attachments/20180512/d7f2cd5d/attachment.html>


More information about the talk mailing list