Re: Parsing of forms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daniele Grillenzoni wrote:
> I noticed that php's way to fill $_GET and $_POST is particularly
> inefficient when it comes to handling multiple inputs with the same name.
> 
> This basically mean that every <select multiple> in order to function
> properly needs to have a name ending in '[]'.
> 
> Wouldn't it be easier to also make it so that any element that has more
> than one value gets added to the GET/POST array as an array of strings
> instead of a string with the last value?
> 
> I can see the comfort of having the brackets system to create groups of
> inputs easily recognizable as such, while I can overlook the
> impossibility of having an input literally named 'foobar[]', having to
> add [] everytime there is a slight chance of two inputs with the same name.
> 
> This sounds flawed to me, as I could easily append '[]' to every input
> name and have a huge range of possibilities unlocked by that.
> 
> This can't be right. Or can it?

Isn't it ironic that a post about multiple form inputs is posted four times?
That's not a good way to make friends here, Daniele...

I really don't understand your complaint - in general if your form has multiple
inputs with the same name, then you either meant to do that, (like a multiple
select, in which case there's not really a big deal to add the []),
or it's wrong and wouldn't work as expected anyway.

You could append [] to every input - that would be lovely, but it would hide the
possibility that you mistakenly gave two inputs the same name.

It's true that every so often I can't work out why something is not posting an
array to PHP when I expected it to, and a look back to the form to find I'd
missed a [] on the name is the answer.

As I like to say in other areas of life (especially to my children), "stop
whining and get on with it!" ( sorry :) )

-- 
Peter Ford                              phone: 01580 893333
Developer                               fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux