Can I have different name and id attributes on the same input element like:
<input name="name" id="first" />
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.
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.
So are you saying that if I name the form, it will the send the checkbox values with it's name?
Originally posted by Rick Bull
So it should be alright to use different IDs and NAMEs?
For <input> yes
Thanks for the help guys. Now I can finish my PHP guestbook