foreach ($array as $value => $name) {
echo '<option value="' . htmlentities($value) . '"' . (($_GET['sel'] === $value) ? ' selected="selected"') . '>' . htmlentities($name) . '</option>';
}
This is fairly neat, and, I think, self-explanatory.