douji3426 2017-07-31 23:30
浏览 77
已采纳

如何获取用户选择的按钮值并在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 :

view

controller

  • 写回答

2条回答 默认 最新

  • duancaiyi7567 2017-07-31 23:36
    关注
    <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');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部