0

Getting error on populating select list

 <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>
Muhammad Muazzam
  • 2,714
  • 6
  • 25
  • 53
  • 1
    Possible duplicate of [PHP Parse/Syntax Errors; and How to solve them?](https://stackoverflow.com/questions/18050071/php-parse-syntax-errors-and-how-to-solve-them) – BenRoob Nov 13 '17 at 10:41

1 Answers1

1

The problem is in this line :

{{isset($template->type) ? @if($template->type=='sms' "selected=true" @endif : 'sms'

try it like this :

<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>
Maraboc
  • 9,461
  • 2
  • 30
  • 45