RE: [PHP] Re: Parsing of forms
| From: | Ford, Mike | Date: | Wed, 20 May 2009 10:50:53 +0000 |
| Subject: | RE: [PHP] Re: Parsing of forms | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-292805@lists.php.net to get a copy of this message | ||
On 19 May 2009 17:10, Andrew Ballard advised:
> On Tue, May 19, 2009 at 10:11 AM, Ford, Mike
> <M.Ford@leedsmet.ac.uk> wrote:
>> On 19 May 2009 14:37, Daniele Grillenzoni advised:
>>
>>>
>>> My complaint is this: a I can have a select multiple with a normal
name,
>>> which is allowed by every spec, but PHP requires me to use [] in
order
>>> to properly retrieve the values.
>>
>> I really don't understand the problem with this -- in fact, I find it
>> quite useful to distinguish inputs which may have only 1 value from
>> those which may be multi-valued. And it all depends on what you mean
by
>> a "normal" name, of course -- no current (X)HTML spec disallows [] as
>> part of a name attribute, so in that sense a name containing them
could
>> be seen as perfectly normal...!! ;) ;)
>>
>> Can you explain why this is such a hang-up for you, as I haven't seen
>> anything in what you've posted so far to convince me it's any kind of
>> problem?
>>
>> Cheers!
>>
>> Mike
>>
>
> I can't speak for the OP, but I've always thought it somewhat odd. An
> HTML form should be able to work correctly without modification
> regardless of the language that receives the input. As it is, it makes
> the HTML for a form implementation specific. You might be able to use
> ASP correctly process a form originally targeted toward PHP, but you
> could not similarly take a form designed for ASP and process it with
PHP
> without modification.
Humph! Yes, ok, I concede this point. I also bow to Daniele's need to
process forms designed by someone else with (not-PHP) in mind. Actually,
I can see the validity of both sides of the argument, and I teeter on
the fence as to whether the [] method is "right" or not!! ;)
> var toppings = document.sundae.toppings;
> // To work with PHP, the above line would
> have to be changed:
> // var toppings =
> document.sundae.elements['toppings[]'];
Actually, document.sundae['toppings[]'] is sufficient (because it is
defined in JavaScript that a['b'] is always exactly equivalent to a.b).
Cheers!
Mike
--
Mike Ford, Electronic Information Developer,
C507, Leeds Metropolitan University, Civic Quarter Campus,
Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom
Email: m.ford@leedsmet.ac.uk
Tel: +44 113 812 4730
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm