2
我有這樣的var_dump結果循環通過請求數據的陣列,並且每個組保存到數據庫laravel
'children' =>
array (size=2)
0 => string 'children on row 1' (length=17)
1 => string 'children on row 2' (length=17)
'type_of_delivery' =>
array (size=2)
0 => string 'type of delivery on row 1' (length=25)
1 => string 'type of delivery on row 2' (length=25)
'date' =>
array (size=2)
0 => string 'Oct 11, 2015' (length=12)
1 => string 'Oct 11, 2015' (length=12)
從我的輸入
<table>
<thead>
<tr>
<th>Children</th>
<th>Type of Delivery</th>
<th>Date</th>
<tr>
<thead>
<tbody>
<tr>
<td><input type="text" name="children[]" /></td>
<td><input type="text" name="type_of_delivery[]" /></td>
<td><input type="text" name="date[]" /></td>
</tr>
<tr>
<td><input type="text" name="children[]" /></td>
<td><input type="text" name="type_of_delivery[]" /></td>
<td><input type="text" name="date[]" /></td>
</tr>
</tbody>
</table>
和我有一個列「孩子」,「 type_of_delivery','date'爲這些請求數據。我想像每套一樣保存它,例如孩子的數組0,數組0的type_of_delivery +數組0,等等。
假設我已經成功保存這些數據,它應該看起來像這樣。
--------------------------------------------------------------
children | type of delivery | date
--------------------------------------------------------------
children on row 1 | type of delivery on row 1 | Oct 11, 2015
children on row 2 | type of delivery on row 2 | Oct 11, 2015
有什麼想法,線索,如何讓它好用?
那你試試這樣遠? – Alex