I'm not quite sure how what ou posed would have worked.
It would need to look something like this:
PHP Code:
echo "<option value='$val_name'" . ($selected == 'selected' ? 'selected=\'selected\'' : '') . ">$val_val</option>";
Check this out for more on shorthand if statements.
http://davidwalsh.name/php-ternary-examples