id & name when identifying html elements
| From: | Roland Tarver | Date: | Wed, 28 May 2003 09:06:47 +0000 |
| Subject: | id & name when identifying html elements | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-149202@lists.php.net to get a copy of this message | ||
Hi
I've got a question about about naming html components (text fields, select boxes etc) when submitting a form to a php page.
First I tried identifying an element using the "id" attribute and found that it was not being posted to the php page. When I use the "name" attribute it did get posted to the page?
I had a look on the w3c html spec and "name" takes precedence over "id" if used together but you should be able to use them individually with no problems.
When you submit a form with this select box, "country" will is not submitted to the php page.
<select *id*="country" onChange="alterForm();">
<option value="one">one</option>
<option value="two">two</option>
</select>
When you use this code, it works fine. "country" gets submitted to the php page?
<select *name*="country" onChange="alterForm();">
<option value="one">one</option>
<option value="two">two</option>
</select>
Any thoughts?
best wishes
roland tarver