RE: [PHP] Re: Variable name as a string
- From: simcha@xxxxxxxxxxxx ("Simcha")
- Date: Thu, 28 Aug 2008 18:36:32 +0200
The reason why... (I think)
Id defines the element as a part of the DOM - it is the identifier of the
Name tells the browser the name of the parameter (i.e. the mane to associate
with the value), not of the element.
PHP and JS are looking for two different things - one wants the element, one
the parameter - so it makes sense (sort of) to use two different terms.
From: tedd [mailto:tedd.sperling@xxxxxxxxx]
Sent: Thursday, August 28, 2008 4:40 PM
Subject: RE: [PHP] Re: Variable name as a string
At 11:50 AM +0100 8/28/08, Ford, Mike wrote:
On 28 August 2008 00:04, tedd advised:
> One of the ways to get around this is to:
<input type="checkbox" name="my_checkboxes"
id="my_checkbox_1" value="1" >
<form name="my_form" ... >
<input type="checkbox" name="my_checkboxes" ... >
checkboxes = document.my_form["my_checkboxes"];
There is no "Why?", this is just another way to do it. In fact, there
are other ways to accomplish this than what both of us have shown.
What's nice about the technique I described here, at least for me, is
that the "value" attribute applies to both name and id. PHP uses name
However, I've been leaning to using getElementById() to create
as well, thus reducing the html code.
I think my next demo will be to show these various techniques.
http://sperling.com http://ancientstones.com http://earthstones.com
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.138 / Virus Database: 270.6.10/1638 - Release Date: 27/08/2008
- Prev by Date: Re: [PHP] grab the complete commandline used ...
- Next by Date: Re: [PHP] Manual Coding vs. CMS Systems
- Previous by thread: RE: [PHP] Re: Variable name as a string
- Next by thread: Re: [PHP]About the magic function __call