php - Retrieve table column in view -
just started working laravel & i'm trying save both item , quantity. far, have no idea how retrieve item's value table column.
here's code
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>
controller
$input = input::all(); ($i = 0; $i < count($input['qty']); $i++) { $data = array( 'item' => ?????, 'quantity' => $input['qty'][$i] ); order::create($data); }
thanks in advance
td name?? think must put input inside td , if form, after sending can retrieve value $_post or $_get depending of method of form
Comments
Post a Comment