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!
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.
] - right square bracket (U+005D) - HTML Symbols.
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.
It is because the developer is using array, and hence he is wrapping the names in []
bar brackets
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With