如何在Laravel 5.6中回显选定的单选值

时间:2018-08-19 23:05:15

标签: laravel bootstrap-4 laravel-5.6

我的用户表中有user_type列。在我的注册刀片视图上,我想根据user_type显示具有不同字段的表单。

<div class="form-check form-check-inline mr-4">
  <input class="form-check-input" type="radio" name="user_type" id="exampleRadios1" value="0" checked>
  <label class="form-check-label" for="exampleRadios1">
    I'm a user
  </label>
</div>
<div class="form-check form-check-inline mr-4">
  <input class="form-check-input" type="radio" name="user_type" id="exampleRadios2" value="1">
  <label class="form-check-label" for="exampleRadios2">
    I'm a professional
  </label>
</div>
<div class="form-check form-check-inline mr-4">
  <input class="form-check-input" type="radio" name="user_type" id="exampleRadios3" value="2">
  <label class="form-check-label" for="exampleRadios3">
    I'm a facility/business
  </label>
</div>

我正在尝试做这样的事情

@if( Request::get('user_type') == 0 )
Show user registration form
@elseif( Request::get('user_type') == 1 )
    Show professional user registration form
@elseif( Request::get('user_type') == 2 )
    Show business registration form
@endif

但是它不起作用。它仅显示显示用户注册表单作为输出,不会根据选择更改

0 个答案:

没有答案