Difference between form id and form name used in html
I want to kn开发者_Python百科ow the exact difference between form id and form name used in html.
Do you mean on the form's elements: e.g. button/input/select & textarea elements?
If so, the name attribute is what is sent when the form is submitted. The id attribute uniquely identifies any element on the page.
The best example I can think of is radio buttons.
Each radio button belongs to a set, and the set has a name. However you may want to link to a particular button by id.
<input type="radio" name="color" id="c1" value="r"/><label for="c1">Red</label>
<input type="radio" name="color" id="c2" value="y"/><label for="c2">Yellow</label>
<input type="radio" name="color" id="c3" value="b"/><label for="c3">Blue</label>
When the form is submitted, only the selected option is sent: (e.g. Yellow)
?color=y
Yes...
You can have a form for email... and have many of them (from a while loop)... They are all email forms (the same) but uniquely identified by id=each user displayed on the page.
<form name="email" id="<?php echo $id; ?>" method=...
精彩评论