+ 2

What is the use of name attribute in HTML forms?

I remove it and also get the same output https://code.sololearn.com/W36iSVO0onPR/?ref=app

20th Sep 2021, 2:22 AM
Rishi
Rishi - avatar
2 ответов
+ 1
its for the name of the values in the form element sent, so if you have an input with the name "name" and when you submit, the form data either with a GET or POST it will be name="[input values]" with [input values] being the text you put in <input> POST method sends your data in form data content type so its hidden but accessible from the server GET method sends your data in a query string like those text after the ? like /my/endpoint?name=rei both have same way of sending the data in a key value pair
20th Sep 2021, 2:35 AM
CutieRei
CutieRei - avatar
+ 2
Oh thank you =) I understand
20th Sep 2021, 7:15 AM
Rishi
Rishi - avatar