For pure MVC methods, how does one do things like selected in select form?

If view is supposed to have no logic how do I solve something like this?

PHP Code:
echo "<select name='statelist'>";
foreach (
$state as $v) {
    
$sel = ($_GET['state'] == $v) ? "selected='selected'" '';
    echo 
"<option value='$v$sel>$v</option>";

}
echo 
'</select>'