I want to have a string as html with blade. I am not sure how to do this with blade using laravel. I have the following code:
<option value="New York" "{{{ Input::old('state', $user->state == 'New York' ? 'selected' : '') }}}">
The output of this is
<option value="New York" "selected">New York</option>
and I want it to be this
<option value="New York" selected>New York</option>
How can I do this? Pointing me to resources would also help. Thank you.
<option value="New York" {{{ Input::old('state', $user->state) == 'New York' ? 'selected' : '' }}}>
Simply remove the quotes. Also it looks like you have a parenthesis in the wrong place. I fixed that as well.
And just an FYI for you, you can use Laravel's Form class to generate a select
for you and automatically select the right option for you:
{{{ Form::select('state', $statesArray, Input::old('state', $user->state)) }}}