0
[SOLVED] name=“” vs value=“”
What’s the difference?
4 ответов
+ 2
Name is what is displayed, value is what it is. Usually you set the value to be a different aspect of the named object.
e.g.
amount of fruit: name = apples, value = 6, name = oranges, value = 3
weather report: name = London, value = rainy, name = Paris, value = sunny
+ 7
The name can be any, serves to bind and combine the fields of one type. The value in contrast to the name is visible to the user and it is sent to the server.
+ 2
Anna's description is better and more accurate than mine, please take a look at this link as well: https://teamtreehouse.com/community/whats-the-difference-between-the-value-and-name-attribute
0
so they’ve written
<input type=“checkbox” name=“gender” value=“1”/> Male
but only ‘Male’ is what’s visible to the user, so why write ‘gender’ in the name element? It doesn’t seems to be doing anything.