+ 1
What is the use of name attribute in <input> element in forms of html
5 odpowiedzi
+ 3
Hi,
Using the same name attribute you are making a set of inputs when the input type is radio or checkbox
So if you make three radio inputs with the same name, you will be able to choose only one
Hope it helps you
+ 2
Name is also useful when you want to do form validation with Php
+ 2
The value is the value of the input haha,
The result of submitting is:
"Name"=Value
If you make a text type input, with name="username", if you put a value as attribute, then the input will have a predefined value, but the user can change it because value is the user input, the result should be
Name of input User input
username = Value
0
then what's the use of value
0
<input type = "password" name="password">
This is inside a form with method POST
PHP:
if ($_POST["password"] =="lol"){
echo "Password correct!";
}