【发布时间】:2020-01-12 00:56:05
【问题描述】:
大家好,如何获取选定的单选按钮值。我想将值存储在选中单选按钮的表上。
我的控制器代码传递给 View $result
$result = DB::table('table')
->where('name', $name)
->where('code', $code)
->get();
return View::make('home.search_result')
->with('result', $result);
在我的视图代码中,我有单选按钮。
{{ Form::open(array('action' => 'BookingController@postValue', 'class'=>'well', 'method' => 'GET')) }}
<table id="search" class="table table-striped table-hover">
<thead>
<tr>
<th></th>
<th>Name</th>
<th>Code</th>
</tr>
</thead>
<tbody>
@foreach($result as $result)
<tr class="success">
<td>{{ Form::radio('result') }}
<td>{{ $result->name}}</td>
<td>{{ $result->code}}</td>
</tr>
@endforeach
</tfoot>
</table>
{{ Form::submit('Add', array('class' => 'btn btn-info')) }}
{{ Form::close() }}
因此,当我单击“添加”按钮时,我尝试将已检查的单选按钮值传递给我的 postValue 函数。
【问题讨论】:
标签: laravel-4 radio-button return-value