我有以下表格:
<div class="container text-center search-container">
<form id="search-form" action="" method="post">
<div class="nopadding col-xs-12 col-sm-2">
<select name="huge" class="form-control input-block-level selectpicker search-selector" data-style="btn-default btn-fill btn-block">
<option disabled>Search in...</option>
<option value="1" selected>foo1</option>
<option value="2">foo2</option>
<option value="3">foo3</option>
</select>
</div>
<div class="nopadding col-xs-12 col-sm-8">
<input type="text" class="form-control input-block-level search-bar" id="searchbar">
</div>
{{ csrf_field() }}
<div class="nopadding col-xs-12 col-sm-2">
<button class="btn btn-info btn-fill search-button input-block-level" type="submit">Search</button>
</div>
</form>
</div>
我将bootstrap-select
用于select
元素。
这会在我的控制器中调用一个方法,但是当我执行dd($request->all()
时,这就是我所获得的:
array:2 [▼
"huge" => "1"
"_token" => "somethingReallyLongAndBoring"
]
基本上,我无法检索我的输入。知道我做错了什么吗?
答案 0 :(得分:3)
您必须将name
属性添加到输入字段。
<input type="text" class="form-control input-block-level search-bar" id="searchbar" name="searchbar">