如何使用表单(复选框)传递用户 ID

我有一个表格,里面有我需要的复选框


我的表格


<input type="submit" form="qwe">

 <form action="{{URL::to('othet_nn')}}" method="get" id="qwe">

                 <input type="checkbox" name="id">

             </form>

我的控制器


public function chek(){

        dd($_GET);

        return view('admin.pages.othet_test');

    }

我需要传递那些在复选框中有复选标记的用户的 ID


人到中年有点甜
浏览 231回答 2
2回答

哈士奇WWW

你可以像这样使用它&nbsp;<form action="{{URL::to('othet_nn')}}" method="post" id="qwe">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<input type="checkbox" name="id" value="1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</form>public function check(Request $request){&nbsp; &nbsp; &nbsp; &nbsp; dd($request->id);&nbsp; &nbsp; &nbsp; &nbsp; return view('admin.pages.othet_test');&nbsp; &nbsp; }

万千封印

在 Laravel 中,您应该使用 Request 类。要查看整个输入,您可以使用:request()->all()并获得您可以使用的单个字段request()->input('id')我建议您阅读有关请求的文档
打开App,查看更多内容
随时随地看视频慕课网APP