title: Get an option ''selected'' based on a $_Session value
body: <p>i am having a platform where every user creates a profile and has to insert his personal info into a DB.One of this is the nationality ,that is being inserted by an HTML drop list (with 100+ countries) when the user is creating his profile for the first time.</p>
  
  <pre><code>&lt;select name="nationality" id="nationality" &gt;
              &lt;option value="0" label="Select a country ... " &gt;Select a country ... &lt;/option&gt;
  </code></pre>
  
  <p></p>
  
  <p>When the user is loging back in to his profile , i want this dropdown list to have his nationality option marked as  ''selected'' .</p>
  
  <p>Nationality's value is into a $_Session , when all data are being selected  when he logs in .</p>
  
  <p>The most easy way to do this is by using a php code inside every option value like this</p>
  
  <pre><code>&lt;option value="GR" label="Greece"   &lt;?php if(($_SESSION['nationality'])=='GR') echo 'selected="selected"'; ?&gt;&gt;Greece&lt;/option&gt;
  </code></pre>
  
  <p>But i can't do this with every option from a list of 300+ countries.I want this to be done by  Javascript .
  I've tried many things but i can't sort it out
  Thank you in advance</p>