That depends on what the target server accepts. There is no definitive standard for this. See also a.o. Wikipedia: Query string:
While there is no definitive standard, most web frameworks allow multiple values to be associated with a single field (e.g. field1=value1&field1=value2&field2=value3).[4][5]
Generally, when the target server uses a strong typed programming language like Java (Servlet), then you can just send them as multiple parameters with the same name. The API usually offers a dedicated method to obtain multiple parameter values as an array.
And, when the target server uses a weak typed language like PHP or RoR, then you need to suffix the parameter name with braces [] in order to trigger the language to return an array of values instead of a single value.
Do note that when you send foo[]=value1&foo[]=value2&foo[]=value3 to a Java Servlet, then you can still obtain them, but you'd need to use the exact parameter name including the braces.
That depends on what the target server accepts. There is no definitive standard for this. See also a.o. Wikipedia: Query string:
Generally, when the target server uses a strong typed programming language like Java (Servlet), then you can just send them as multiple parameters with the same name. The API usually offers a dedicated method to obtain multiple parameter values as an array.
The
request.getParameter("foo")
will also work on it, but it'll return only the first value.And, when the target server uses a weak typed language like PHP or RoR, then you need to suffix the parameter name with braces
[]
in order to trigger the language to return an array of values instead of a single value.In case you still use
foo=value1&foo=value2&foo=value3
, then it'll return only the first value.Do note that when you send
foo[]=value1&foo[]=value2&foo[]=value3
to a Java Servlet, then you can still obtain them, but you'd need to use the exact parameter name including the braces.I know this post is really old, but I have to reply because although BalusC's answer is marked as correct, it's not completely correct.
You have to write the query adding "[]" to foo like this: