[kwlug-disc] Sending array variable over Web/CGI?

Raymond Chen raymondchen625 at gmail.com
Sat May 12 18:55:28 EDT 2018


What's wrong with the CGI script building an array? I think using the same
name multiple times is the way to go, at least it's common in other
language like Java.



On Sat, May 12, 2018 at 6:39 PM Khalid Baheyeldin <kb at 2bits.com> wrote:

> You should really be using a POST for this, so the data is not in the URL
> at all.
>
> But to your question, you can do:
>
> /cgi?A[0]=111&A[1]=222 ... etc.
>
> If it does not work, try escaping it with:
>
> %5B for [, and %5C for ]
>
>
> On Sat, May 12, 2018 at 5:52 PM, William Park via kwlug-disc <
> kwlug-disc at kwlug.org> wrote:
>
>> Hi all,  (apology if you're seeing it again)
>>
>> 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 places where a same variable is repeated, eg.
>>     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>
>>
>> _______________________________________________
>> kwlug-disc mailing list
>> kwlug-disc at kwlug.org
>> http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org
>>
>
>
>
> --
> Khalid M. Baheyeldin
> 2bits.com, Inc.
> Fast Reliable Drupal
> Drupal optimization, development, customization and consulting.
> Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra
> Simplicity is the ultimate sophistication. -- anonymous
>
> _______________________________________________
> kwlug-disc mailing list
> kwlug-disc at kwlug.org
> http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20180512/6a76ea87/attachment.htm>


More information about the kwlug-disc mailing list