View Single Post
06-27-2012, 01:34 AM
#1
Dan is offline Dan
Dan's Avatar
Status: Request a custom title
Join date: Feb 2005
Location:
Expertise:
Software:
 
Posts: 3,164
iTrader: 15 / 86%
 

Dan is an unknown quantity at this point

  Old  Adding "selected" into a select form

I have $country which stores the 2 letter country code of a user. US for example.

Code:
<select id="countries">						
    <option value="US">United States</option>
    <option value="EN">England</option>
    <option value="AU">Australia</option>
    <option value="CA">Canada</option>
    etc.
</select>
What's the best practice to add "selected" to the option of the users country code?

I'm against adding a million if's.

Reply With Quote