Insert a value to hidden input Laravel Blade

前端 未结 2 688
花落未央
花落未央 2021-02-02 12:17

How to pass a value to hidden input ?

Create form :

@if (isset($id))
    {!! Form::hidden(\'edition\', $id) !!}
@endif

I got the form i

相关标签:
2条回答
  • 2021-02-02 12:36

    you can do this with the help of blade <input type="hidden" value="{{$user->id}}" name="user_id">

    0 讨论(0)
  • 2021-02-02 13:02

    Usually, this is used in Blade templates.

    Just pass the name and value to the method.

    {{ Form::hidden('invisible', 'secret') }}
    

    This creates a very simple element which looks like the following.

    <input name="invisible" type="hidden" value="secret">
    

    To add other attributes, pass a third argument to the method. This third argument must be an array.

    {{ Form::hidden('invisible', 'secret', array('id' => 'invisible_id')) }}
    

    Now the input has an id attribute.

    <input id="invisible_id" name="invisible" type="hidden" value="secret">
    

    Check out : Creating a Hidden Input Field


    If still not work check you project have Laravel Collective installed

    In controller method check

    public function store(Request $request)
    {
        $name = $request->input('name');
    }
    
    0 讨论(0)
提交回复
热议问题