4

Is there any known issue or drawback for naming from elements like this:

<form method="POST" ... >
    <input name="category[title]" ...>
    <input name="category[desc]" ...>
</form>

The POST result will be something like this:

Array 
(
    [category] => Array
        (
            [title] => 0
            [desc] => 0
        )
)

Does it work in all the major web browsers? Also is there any specific name for it?

Mahdi
  • 9,247
  • 9
  • 53
  • 74

1 Answers1

2

Check it:

/* send a object like it:
Person:
{
 name: 'Homer'
 age : 50
 kids :[
  { name: 'Liza', age: 9 }, 
  { name: 'Bart', age: 8 }, 
  {name: 'Maggie', age: 2 }
 ]}
 */
<form method="post" action='my_magic_form.xpto'>
    <input type="text" name="name" placeholder="Your Name" />
    <input type="text" name="age" placeholder="Your age" />
    <input type="text" name="kids[0].name" placeholder="First child name" /> 
    <input type="text" name="kids[0].age" placeholder="First child age" />
    <input type="text" name="kids[1].name" placeholder="Second child name" />
    <input type="text" name="kids[1].age" placeholder="Second child age" /> 
    <input type="text" name="kids[2].name" placeholder="Third child name" /> 
    <input type="text" name="kids[2].age" placeholder="Third child age" />
</form>