[Libwebsockets] Parse form with array values

Andy Green andy at warmcat.com
Sun Oct 18 08:38:14 CEST 2020

On 10/18/20 3:39 AM, Sylvain Lefebvre wrote:
> Hi,
> Is there a way to parse a form which post array values. For example if I 
> have the following in my html page.
> <|input type="text" |name="foo[]" value="bar">
> <|input type="text" |name="foo[]" value="baz">
> If I use "foo" as a param in param_names[] it returns nothing.

Where is the RFC I can read that specifies the format the client 
produces for that HTML?

> The only way I can get a value is if I append %5B%5D to the param 
> name. So, if I use "foo%5B%5D" it returns 'bar' but nothing else. How 
> can I get 'bar' and 'baz'? One of my page will have a 16 X 16 array. I 
> would like to avoid writing 256 different params!

Then don't do that... why not just issue JSON that contains the internal 
structure that you want cleanly and unambiguously via XMLHttpRequest POST?


More information about the Libwebsockets mailing list