You should read the HTML spec for how HTML elements work. Option: http://www.w3.org/html/wg/drafts/html/master/forms.html#the-option-ele ment
So what you do is to set the "selected" attribute of the option you want the Select to have selected. You already seem to have some logic to output the selected="selected" text, but I guess if it's not working, your logic is bung. Superficially, it looks correct though.
What does the actual resultant mark-up look like? Looking at that might cast somer light on the scene.
--
Adam