I have an edit page for user profiles. One option is 'Country' with all the countries listed in the php file (countries are not loaded from database). On the user edit profile page I want to be able to select the currently stored option value from the list.
I could do this:
<option value="Afghanistan" <?php if ($results['country'] == 'Afghanistan') echo 'selected';?> >Afghanistan</option>
<option value="Albania" <?php if ($results['country'] == 'Albania') echo 'selected';?> >Albania</option>
<option value="Algeria" <?php if ($results['country'] == 'Algeria') echo 'selected';?> >Algeria</option>
<option value="American Samoa" <?php if ($results['country'] == 'American Samoa') echo 'selected';?> >American Samoa</option>
// The rest of the countries here :(..
Is there a better (cleaner) way to do this without putting all the countries into the db?