I'm working on a simple calculator app in Laravel Blade. We have not moved to models yet, just working in views and routes, so I keep running into options I haven't learned how to use yet.
My application is running without issue but is not retaining the selected value in the dropdown on POST. I am able to print the value to the screen, and it is working in a later selector. I think I just need to write an if statement in the options to set the selected value, but I can't find syntax that I understand/am allowed to use in this project.
<div class="form-group">
<select class="form-control form-control-lg" id="operatorInput" name="operatorInput" value="{{Session::get('operator')}}">
<option value="+" @if(Session::get('operatorInput') == "+" ? "selected" : "" )@endif>Addition (+)</option>
<option value="-" @if(Session::get('operatorInput') == "-" ? "selected" : "" )@endif>Subtraction (-)</option>
</select>
</div>
I get a throwable error on this example, so I know it isn't correct.