[英]get select box value Laravel
I use laravel 5.4.我使用 Laravel 5.4。
<select name="type" id="type">
<option value="0">title1</option>
<option value="1" selected>title2</option>
<option value="2">title3</option>
</select>
I record the data to the database.我将数据记录到数据库中。 But I can not get the value of the select box tag.
但我无法获得选择框标签的值。 I am using the following codes in Controller and as a result I get text.
我在 Controller 中使用以下代码,结果我得到了文本。
$type = $request->get('type');
or
$type = Input::get('type');
print_r($type) ;
result: "title2"结果:“title2”
I did not find any results in my research.我的研究没有找到任何结果。 Please help me.Is there a recommendation?
请帮帮我,有推荐的吗?
将$request->get('type')
改为$request->input('type')
最简单的方法是$request->type
来获取控制器中选择选项的值;)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.