Jump to content

looking for opinions


astralaaron

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>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...