从这样的元素命名有任何已知的问题或缺点:
<form method="POST" ... >
<input name="category" ...>
<input name="category[desc]" ...>
</form>
POST结果将是这样的:
Array
(
[category] => Array
(
=> 0
[desc] => 0
)
)
它适用于所有主要的Web浏览器吗?还有什么具体名称吗?
最佳答案 核实:
/* 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>