0

What is the difference between the <input name = ""> and <input value = ""> attributes for <form> in HTML?

25th Aug 2018, 10:26 PM
David Sebastián Mendoza Cruz
David Sebastián Mendoza Cruz - avatar
3 Réponses
25th Aug 2018, 11:42 PM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar
+ 3
(Just additional info) <input type="text" name="animal" value="cat"> That creates a field with "cat" already filled in. If you then submitted this it would be sent from the browser as: animal=cat ...which is essentially (using the original terms): name=value
26th Aug 2018, 1:37 AM
Kirk Schafer
Kirk Schafer - avatar
+ 1
Name is to group the inputs (e.g. if you have two sets of radio buttons but you don't want them to get mixed up, you might give the inputs for the first set the name "set1" and the inputs for the second set the name "set2"). Value is the (default) information that you want to actually have passed around in the background (roughly speaking) and represents different things depending on the input type. That should provide some context for the links Vincent posted earlier.
26th Aug 2018, 12:52 AM
Janning⭐
Janning⭐ - avatar