vendredi 3 août 2018

laravel - set selected in the html dropdown menu

I have a post form that is shared between create and edit function.

This is my edit.blade.php:

@extends('posts.create')
@section('editName',$post->name)
@section('editselected',$post->selected)

Then, I use @yield to get my value:

<input name="name" value="@yield('editName')"  type="text" class="form-control" placeholder="title">

I can do that with most of the input fields, but I want to do that in the dropdown menu. I tried:

<select class="selectpicker" name="myoptions" value="@yield('editselected')">
<option >1 hour</option>
<option >3 hours</option>
<option >5 hours</option>
</select>

and get an error:

Parse error: syntax error, unexpected '<'

I obviously doing it wrong. But How can I make it work?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire