0
剛開始使用laravel &我試圖保存物品和數量。到目前爲止,我不知道如何從表列中檢索項目的值。在視圖中檢索表列
下面的代碼
HTML
<table class="table table-condensed table-hover" id="myTable">
<thead>
<tr>
<th>Item</th>
<th class="text-center">Quantity</th>
</tr>
</thead>
<tbody class="body">
<tr>
<td name="item[]">Book</td>
<td>
<select class="form-control" name="qty[]">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
</td>
</tr>
<tr>
<td name="item[]">Pencil</td>
<td>
<select class="form-control" name="qty[]">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
</td>
</tr>
</tbody>
</table>
控制器
$input = Input::all();
for ($i = 0; $i < count($input['qty']); $i++) {
$data = array(
'item' => ?????,
'quantity' => $input['qty'][$i]
);
Order::create($data);
}
在此先感謝