填写选择列表时出错
<select name="notificationtype" required class="form-control">
<option value="sms" {{isset($template->type) ? @if($template->type=='sms' "selected=true" @endif : 'sms'}}> {{ 'SMS'}}</option>
<option value="email" {{ isset($template->type) ? @if($template->type=='email' "selected=true" @endif : 'email'}}>{{'Email'}}</option> </select>
答案 0 :(得分:0)
问题出在这一行:
{{isset($template->type) ? @if($template->type=='sms' "selected=true" @endif : 'sms'
尝试这样:
<select name="notificationtype" required class="form-control">
<option value="sms" @if(isset($template->type) && $template->type=='sms') "selected=true" @endif > SMS </option>
<option value="email" @if(isset($template->type) && $template->type=='email') "selected=true" @endif > Email </option>
</select>