[GTALUG] Sending array variable over CGI ?
ted leslie
ted.leslie at gmail.com
Sat May 12 19:37:32 EDT 2018
If you are in control of both ends, and have a common environment at both
ends (or different env. which have standards of ...),
then you can use a de/serialization library as well as encode/decode it to
sit on the cgi (get/put...),
advantage of this would be hiding, ability to present data that may mess up
the url (i.e. =, &, ', ", etc),
as well the libraries have your serialization and re-hydration to object
all done for you, even for much more complex object then an array.
To an extreme, you would pretty much just have to make a
encodeToUrl( [object name], [encode method] ); on your formation of url,
and
MyObjectName myObj(decodeFromUrlArg(["arrayname"], [encode method]);
But this could be over-kill for your needs (pulling a lib for this into
your current setup).
This also assumes reflection based language (java, .net....) or
accompanying/annotated meta-data (c++).
-tl
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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/talk/attachments/20180512/98bff301/attachment.html>
More information about the talk
mailing list