1
我是Laravel的新手。我正在构建一个显示已检查记录的代码。 以下是我的代码。在laravel的另一个页面上显示已检查的值
{!! Form::open(array('action' => '[email protected]','method' => 'POST', 'name' => 'f1'))!!}
@foreach($clients as $client)
{!! Form::checkbox('agree', $client->email, null, ['class' =>'questionCheckBox']) !!}
<article>
{{ $client->user_name }}
{{ $client->email }}
</article>
@endforeach
{!! Form::close() !!}
{!! Form::open(array('action' => '[email protected]','method' => 'GET'))!!}
<div class="form-group">
{!! Form::submit('show-selected ',['class' => 'btn btn-primary form-control']) !!}
</div>
{!! Form::close() !!}
我一定要显示$client->emai
l当我点击按钮"show-selected"
。
我控制器的方法是,
public function display() {
$client = Client::all();
dd(Input::has('agree'));
$client = Input::has('agree') ? true : false;
return $client->email;
}
这应返回true
,但它返回false
,我没有得到如何获得另一页上的检查复选框的值。
搜索AJAX。 – aldrin27
在带有“显示”操作的窗体中,您没有通过复选框值。这是乳清你得到错误..在你的“显示()”检查由dd(输入::所有()); ....是否需要使用2种形式。 ?? – ArtisanBay
@ArtisanBay:显示代码正常运行正常。你能告诉我如何获取我的表格 {!! Form :: checkbox('agree',$ client-> email,null,['class'=>'questionCheckBox'])!!} 我传递的值是“$ client-> email”。 – Shweta