I have form which has one select box and i need to pass select box selected value to laravel resources show()
method for display specific details of selected value.
<form action="{{ action('supplierController@show') }}" method="POST" class="form" role="form">
<div class="form-group">
<label for="inputEmail3" control-label">company name</label>
<select class="form-control js-example-basic-single" name="seller">
<option value=""></option>
@foreach($supplierlist as $supplier)
<option value="{{ $supplier->company_name }}">{{ $supplier->company_name }}</option>
@endforeach
</select>
</div>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<button type="submit" class="btn btn-primary">GO</button>
</form>
Values of selectbox come from database so how can i pass value of selected value of selectbox to my controller.
<select>
应该有一个名称,然后可以通过request()->get('name')
获得该值。
Please try the following In your view part include the following consider the $categories contains the category to be in the options
{!! Form::select('category', array('0' => 'Choose Category') + $categories , ['class' => 'medium m-wrap']) !!}
In your controller include
$category = $request->get('category');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.