Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Square brackets in name attribute of input tag

I see a lot of time there is square brackets in the name attribute of input tag. What is it for and why it's used?

   `input id="academy_name" name="academy[name]" size="30" type="text" />` 

So why name="academy[name]" and not just name="academy".

Please help!

like image 729
Nikhil Yeole Avatar asked Oct 12 '12 07:10

Nikhil Yeole


People also ask

What do square brackets mean in HTML?

The square brackets have nothing to do with HTML. They probably belong to the template and will be replaced by actual value from the template engine.

How do you put square brackets in HTML?

] - right square bracket (U+005D) - HTML Symbols.

What is input name attribute?

Definition and Usage. The name attribute specifies the name of an <input> element. The name attribute is used to reference elements in a JavaScript, or to reference form data after a form is submitted. Note: Only form elements with a name attribute will have their values passed when submitting a form.


1 Answers

It is because the developer is using array, and hence he is wrapping the names in [] bar brackets

like image 68
Mr. Alien Avatar answered Oct 17 '22 02:10

Mr. Alien