INPUT, name and id
Can I have different name and id attributes on the same input element like:
I thought that the HTML 4.01 specs said they must be identical, but when I (quickly) checked I could only find that rule for anchors.
<input name="name" id="first" />
I think the difference here is that name for <a> (and some other tags) has the same function as ID, while name for <input> is a form control name
So it should be alright to use different IDs and NAMEs? I wanted them to be different because I have two checkboxes (so need the same name), but I wanted different IDs so I can associate a label with them each.
I'd say typically you'd name the form containing the checkboxes; rather than each box, and then give each checkbox a unique id, or name.
Although it is perfectly legal to have the same name occurring for different input elements.
Last edited by Robert Wellock; 12-12-2002 at 11:46 AM.
So are you saying that if I name the form, it will the send the checkbox values with it's name?
For <input> yes
Originally posted by Rick Bull
So it should be alright to use different IDs and NAMEs?
Thanks for the help guys. Now I can finish my PHP guestbook
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)