php - Laravel form echo variable -
i still learning how work laravel. have learned how make form in laravle. have trouble echo variable. want is: want echo variable value of input-field if variable exists, otherwise should echo nothing. form line looks this
{{form::text( 'league_name', '@if(isset($varialble) {{$variable}} @else {{$nothing}} @endif)' )}}
how can echo variable in form?
i using blade btw.
this right way it:
{!! form::text('league_name', isset($varialble) ? $variable : '') !!}
if you're using php7, can this:
{!! form::text('league_name', $varialble) ?? '') !!}
update
to add placeholder, pass in array third parameter. also, want pass class:
{!! form::text('league_name', isset($varialble) ? $variable : '', ['placeholder' => 'my placeholder', 'class' => 'form-control']) !!}
Comments
Post a Comment