+ 6

What happens if we'll not use name attributes???

<form> <input type="text" name="username" /><br /> <input type="password" name="password" /> </form> . Suppose we'll not use here name attribute. Does it effect the output and if so then how? Please help🙏🙏🙏🙏🙏

6th Mar 2017, 4:18 AM
Abhijeet Ranjan
Abhijeet Ranjan - avatar
2 Respostas
+ 5
It doesn't effect the output but it does effect further processing. Since you have created a form, the data entered by the user is what you want and so you would like to access it in the server side. The "name" attribute helps you to recognize which info entered in the form you want to access. Like, if anyone want to call you, they identify you by your name, so similarly the case here.
6th Mar 2017, 5:00 AM
Saumya
Saumya - avatar
+ 4
the name attribute is what permits to identify the input and its data when working with a server side language. for instance, in PHP, you would have access to $_POST["username"] superglobal that you can process and do whatsoever you want with it. Otherwise, from an HTML perspective, it will not affect anything related to the display. puting it or not is therefore indifferent.
6th Mar 2017, 4:29 AM
CHMD
CHMD - avatar