Your conditional is failing:
{{ $month == $cement_cmonth->cmonth ? "selected" : "" }}
The above is not evaluating to true
hence the selected
attribute not being applied to any of your option
s.
This means your $month
and $cement_cmonth->cmonth
values are not equal. This could be because they are genuinely not the same ('jan' != 'feb')
or it could be the values are the same but the casing differs.
As you are using strings
you need to be careful of character casing as ==
is case sensitive.
The following evaluates to false:
'jan' == 'Jan'
To avoid this issue, use strcasecmp
:
{{ strcasecmp($month, $cement_cmonth->cmonth) === 0 ? "selected" : "" }}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…