laravel没有提交简单的表格

时间:2017-04-19 09:15:51

标签: php forms laravel submit

我正在尝试提交一个简单的表单,但它不是重定向或其他任何内容。

代码:

String [] strArr = str.split("\\n");

简单的后端

@foreach($admins as $admin)
    <form method="post" action="/admin/medewerkers">
        {{csrf_field()}}
        <input type="text" value="{{$admin->id}}" name="userid" hidden>
        <tr>
            <td>{{$admin->name}}</td>
            <td>{{$admin->email}}</td>
            <td><a data-target="#myModal{{$admin->id}}" data-toggle="modal"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> </a> </td>
            <td> <button type="submit" class="btn btn-xs btn-danger" name="delete" id="delete"> Delete </button></td>
        </tr>
    </form>
@endforeach

我在这里做错了什么?谢谢!

1 个答案:

答案 0 :(得分:1)

您无法使用包含<tr> only的表单 试试这个:

@foreach($admins as $admin)


        <tr>
            <td>{{$admin->name}}</td>
            <td>{{$admin->email}}</td>
            <td><a data-target="#myModal{{$admin->id}}" data-toggle="modal"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> </a> </td>
            <td> <form method="post" action="/admin/medewerkers"> 
                 {{csrf_field()}}
                <input type="text" value="{{$admin->id}}" name="userid" hidden> 
               <button type="submit" class="btn btn-xs btn-danger" name="delete" id="delete"> Delete </button> </form>
            </td>
        </tr>

@endforeach