在Laravel 5.3中获取提交按钮的价值 [英] Getting value of a submit button in Laravel 5.3

查看:54
本文介绍了在Laravel 5.3中获取提交按钮的价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面上有一个表格

 <form method="post" action="{{url('/vpage')}}"> 
 <input type="hidden" name="_token" value="{{ csrf_token() }}">
    <div class="w100">
        <button name="hostel1" class="submitBTN addnowBtn" type="submit" value="The Venetian"> Add Now</button>
    </div><!--w100-->
 </form>

我将请求打印在控制器中,例如

I getting the request printed in my controller like

    public function vegaspage(Request $request){
    dd($request);
    die;
   } 

我的页面上还有很多字段,当请求参数进入浏览器时,提交按钮值不在请求中 有什么想法吗?

I have also have many fields on my page , when the request params comes to browser the submit button value is not coming in request Any ideas ?

推荐答案

将按钮代码更改为:

<input name="hostel1" value="The Venetian" type="hidden">
<button class="submitBTN addnowBtn" type="submit"> Add Now</button>

在控制器中,使用它来获取值:

In the controller, use this to get the value:

$request->hostel1

这篇关于在Laravel 5.3中获取提交按钮的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆