PHP - How to Display Current Selected Value in Form field

<option value=10>10</option><option value=20 selected=selected>20</option><option value=30>30</option>
for ($i = 10, $i <= 30; $i +=10) { $selected = ($i == $rows) ? ' selected=selected' : ''; echo '<option value='.$val[$i].'$selected>.$val[$i].</option>';}