0
我有一个窗体的每一行有四个值:id,类别名称,注释和状态。但是表单有很多行。当我更新的形式,我需要能够在数据库中保存每一行作为这样的一行数据:如何保存多维数组
cat_id = 42, cat_name= cedar, notes = notes for cedar, status = active.
我的问题是,$_POST
阵列是不是用这种方式组织:
Array (
[_token] => GJG5lP2bz08OPeEAfn7DKigFWgxkB1ZxdEssVYgO
[cat_id] => Array ([42] => 42 [22] => 22 [1] => 1 [31] => 31)
[cat_name] => Array ([42] => cedar [22] => Materials [1] => Product
[31] => Slates)
[notes] => Array ([42] => notes here [22] => Notes here materials [1]
=> Notes here products [31] => Notes here slates)
[status] => Array ([42] => active [22] => active [1] => active [31]
=> active)
)
我需要如何得到这个安排,因此它可以与SQL保存帮助,
使用Laravel,但我预计,在这种情况下,除非无关不知何故,我可以得到它成可用的集合。
谢谢!
我改变了我的html到你的建议,但是结果数组是相同的。 阵列:2▼ “_token”=> “GJG5lP2bz08OPeEAfn7DKigFWgxkB1ZxdEssVYgO” “项目”=>数组:4 [▼ “CAT_ID”=>数组:4 [▼ 42 => “42” 22 =>“22 “ 1 => ”1“ 31 => ”31“ ] ” 'cat_name“'=>数组:4 [▼ 42 => ”杉树“ 22 => ”材料“ 1 =>” 产品“ 31 => ”石板“ ] ” '音符“'=>数组:4 [▶] ” '状态'“=>数组:4 [▶] ] ] – Vince