0
What is the difference between the <input name = ""> and <input value = ""> attributes for <form> in HTML?
3 Réponses
+ 1
Hi David Mendoza,
Take a look at these sources, hope it will help you👍
https://www.w3schools.com/tags/att_input_value.asp
//
https://www.w3schools.com/TAGS/att_input_name.asp
+ 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
+ 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.