Re: Re: Parsing of forms

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

 



On Wed, May 20, 2009 at 6:50 AM, Ford, Mike <M.Ford@xxxxxxxxxxxxxx> wrote:
> On 19 May 2009 17:10, Andrew Ballard advised:
>>               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
>

True enough. I suppose it makes sense to just use the JavaScript array
notation syntax for accessing form elements all the time and not worry
about it any more.

I'll admit that when I first learned PHP3, it even seemed cool that
you could add elements to arrays (even nested or multi-dimensional
arrays) automatically by placing the appropriate square brackets in
the field name. At the time, having the language automatically create
variables for each of my form fields compared with what I had to do in
PERL seemed pretty cool too. ;-) I just thought it ridiculous the
first time I migrated a simple form processing script from PERL to PHP
that I had to change the HTML and the related JavaScript to be
compatible with PHP.

Andrew

-- 
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