php 前台生成多维数组 后台批量添加

同一个地方绊倒两次,记录一下哈

1)前台表单,看 name

 1 <div class="tab-pane row " id="tab-1" >
 2     <input type="hidden" name="data[1][Type]" value='' class="form-control" id="data[1][Type]">
 3     <input class="form-control" type="text" id="data[1][UnitPrice]" name="data[1][UnitPrice]" value="" placeholder="请输入单价" >
 4     <input class="form-control" type="text" id="data[1][Quantity]" name="data[1][Quantity]" value="" placeholder="请输入数量" >
 5     <input class="form-control" type="text" id="data[1][Name]" name="data[1][Name]" value="" placeholder="请输入费用名称" >
 6     <input class="form-control" type="text" id="data[1][Description]" name="data[1][Description]" value="" placeholder="请输入费用描述" >
 7 </div>
 8 <div class="tab-pane row " id="tab-2" >
 9     <input type="hidden" name="data[2][Type]" value='' class="form-control" id="data[2][Type]">
10     <input class="form-control" type="text" id="data[2][UnitPrice]" name="data[2][UnitPrice]" value="" placeholder="请输入单价" >
11     <input class="form-control" type="text" id="data[2][Quantity]" name="data[2][Quantity]" value="" placeholder="请输入数量" >
12     <input class="form-control" type="text" id="data[2][Name]" name="data[2][Name]" value="" placeholder="请输入费用名称" >
13     <input class="form-control" type="text" id="data[2][Description]" name="data[2][Description]" value="" placeholder="请输入费用描述" >
14 </div>

2)后台打印数据

 1 Array
 2 (
 3     [1] => Array
 4         (
 5             [Type] => 
 6             [UnitPrice] => 
 7             [Quantity] => 
 8             [Name] => 
 9             [Description] => 
10         )
11     [2] => Array
12         (
13             [Type] => 
14             [UnitPrice] => 
15             [Quantity] => 
16             [Name] => 
17             [Description] => 
18         )
19 ) 

 

posted @ 2018-12-08 16:27  北海北……  阅读(388)  评论(0编辑  收藏  举报