mercredi 25 octobre 2017

Get value from array textbox in laravel

I want to get model_id[] value in foreach by click submit but i get all from model_id[].

In my form:

<form id="modify" class="form-horizontal" method="POST" action=""
      onsubmit="return confirm('Are you sure to do this?');">
    {!! csrf_field() !!}
    <table class="table-hover" width="100%" cellpadding="5" cellspacing="0">
        @foreach($data_model as $key=> $va)
            <tr>
                <td width="30px"></td>
                <td width="280px">
                    <input type="hidden" id="model_id[]" name="model_id[]" value="  ">
                    <input type="text" name="txt_depmo" id="txt_depmo" style="width: 280px;"
                           value="">
                </td>
                <td>
                    <input type="submit" class="btn btn-outline-primary" name="submit" id="submit" value="Updates">
                    <input type="submit" class="btn btn-outline-danger" name="submit" id="submit" value="Removes">
                </td>
            </tr>
        @endforeach
    </table>
</form>

My Controller:

public function modifymodel(Request $request){
   $modelidd=Input::get('model_id');
 }

but i got the result all array in model_id[].

["1","3","8","9"]

i want to get id from my button click



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire