如何从一个隐藏的输入字段,而不提交使用laravel的值


How to get the value from a hidden input field without submitting using laravel

我有以下代码:

在我看来:

{{Form::open()}}
{{Form::hidden ('hiddentitle', 'title info')}}
{{Form::close()}}

In my controller:

  class PController extends BaseController {
   public function user(){
  $hiddentitle               = Input::get('hiddentitle');

  dd($hiddentitle); //I get NULL values      
  return View::make('person.user');
    }
   }

谁能解释为什么我得到NULL值的$hiddentitle ?我知道这看起来很简单,但这是一个大问题。由于

如何提交表单?

我刚刚测试了这段代码,它适用于我的Laravel 5。

routes.php

Route::resource('test', 'TestController');
控制器

public function create()
{
    return view('test.create');
}
public function store()
{
    dd('Input::get('hiddentitle'));
}

测试/create.blade.php

{!! Form::open() !!}
{!! Form::hidden ('hiddentitle', 'title info')!!}
{!! Form::submit('Go') !!}
{!! Form::close() !!}
结果

"title info"

按评论编辑

我不清楚你到底想做什么。如果你张贴你的尝试,我可以更好地回答你的问题。我相信你会愿意这样做的。

@foreach ($user->books as $book)
    @if(!emtpy($book->title)
        {!! Form::open() !!}
        {!! Form::hidden ('hiddentitle', 'title info')!!}
        {!! Form::submit('Go') !!}
        {!! Form::close() !!}
    @endif
@endforeach