2017-11-13 5 views
0

구문 분석 오류 : 구문 오류, 예기치 않은 '<'laravel 블레이드 템플릿 선택 목록을 채우기에 오류가

<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> 
+1

가능한 [PHP 구문 분석/구문 오류] 복제본입니다. 어떻게 해결할 수 있습니까?] (https://stackoverflow.com/questions/18050071/php-parse-syntax-errors-and-how-to-solve-them) – BenRoob

답변

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> 
+0

오류가 해결되었지만 선택이 여전히 작동하지 않는 동안 첫 번째 항목 만 선택됩니다. –

+0

''selected = true "'를''selected"'!!로 바꾸십시오! – Maraboc

+0

여전히 동일한 작업 –