Jump to content

looking for opinions


Recommended Posts

This is not a big problem but just something that is kind of annoying because I have to write the options twice just to select the correct option when the page loads. So I was just wondering, how does everyone else handle this?

<select name="selectTeamType"><?php$Y = $data['teamType'];$options = '<option value="0">select one</option>';$options .= ($Y == 1) ? '<option selected="selected" value="1">Soccer</option>' : '<option value="1">Soccer</option>';$options .= ($Y == 2) ? '<option selected="selected" value="2">Football</option>' : '<option value="2">Football</option>';$options .= ($Y == 3) ? '<option selected="selected" value="3">Baseball</option>' : '<option value="3">Baseball</option>';$options .= ($Y == 4) ? '<option selected="selected" value="4">Rugby</option>' : '<option value="4">Rugby</option>';echo($options);?></select>

Edited by astralaaron
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...