+ 4
What is different of "id" and "name" attributes in "input" elements?
<input id="user" name="username" type="text" /> I don't know what function
2 Answers
+ 2
To get the result of your form, you have to get the variable using the name (for instance, using PHP and the POST method, it will be in $_POST["username"]) but if you want to put a label, to use some CSS or to verify the value with JS, you will use the id.
+ 2
"id" is used to decorate(css) or script(js) the particular tag while "name" is used to get the data to the server from the client.. name is also useful to make one set of many inputs, for example;
<input type=radio name="one">
<input type=radio name="one"> they both should match otherwise it will not work together for the same input