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

William Park opengeometry at yahoo.ca
Sun May 13 01:06:16 EDT 2018


The only problem with using same variable name is that you can't skip
element.  I guess, the correct answer is "it depends on what is running
as CGI script". :-)
-- 
William Park <opengeometry at yahoo.ca>

On Sat, May 12, 2018 at 06:55:28PM -0400, Raymond Chen wrote:
> 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
> >

> _______________________________________________
> kwlug-disc mailing list
> kwlug-disc at kwlug.org
> http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org




More information about the kwlug-disc mailing list