在Laravel中下拉选择表单 [英] Drop down select form in Laravel
本文介绍了在Laravel中下拉选择表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以知道我的代码有什么问题吗?我在数据库中注册了三个用户类型名称,但是我的代码将导致出现三个下拉菜单,每个菜单上都具有单独的用户类型名称.
may I know what is wrong with my codes? I have three user type name registered in my database however my codes will result to three drop down menus with individual user type name on each.
@foreach($user_types as $usertype)
<div class="form-group">
{!! Form::select('chap_user_type_name', array('chap_user_name' => $usertype), null, ['class' => 'form-control']) !!}
</div>
@endforeach
推荐答案
删除foreach并将数组传递给select这样
remove foreach and pass array into select like this
{!! Form::select('chap_user_type_name', $user_types, null, ['class' => 'form-control']) !!}
这篇关于在Laravel中下拉选择表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文