如何获取用户选择的按钮值并在laravel 5.4中的控制器上使用它
I am new with php and laravel and I have a problem:
How to get a button value chosen by the user and use it on the controller to retrieve specific information from database.
I get the "termkey" from the database and I need to know the value selected by the user.
This is my view :
我是php和laravel的新手,我遇到了问题: p>
如何获取用户选择的按钮值并在控制器上使用它来从数据库中检索特定信息。 p>
我从数据库中获取“termkey”,我需要知道值 由用户选择。 p>
这是我的观点: p>
p>
p > div>
<button name="termkey">{{ $ca->termkey }}</button>
change the upper to
<button name="termkey" value="{{ $ca->termkey }}">{{ $ca->termkey }}</button>
then in controller
$request->input('termkey');
you have to use value attribute in your button tag and why there is a closing anchor tag I don't understand. IN value attribute u can set any kind of value you want. then u can access it in the controller like you did
<button type="submit" name="termKey" value="{{$c->termKey}} "><span class="badge">{{$c->total}}</span></button>
And please always try to paste code not image