title: How can I select a option based on its value and a variable?
body: <p>I have a HTML like this:</p>
  
  <pre><code>&lt;select id="job" name="job" class="form-control"&gt;
      &lt;option value="First Option"&gt;First Option&lt;/option&gt;
      &lt;option value="Second Option"&gt;Second Option&lt;/option&gt;
      &lt;option value="Third Option"&gt;Third Option&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Also I have a PHP variable like this: <code>$val = "Second Option";</code>. Now I need to add <code>selected</code> attribute to the option that has the same value as <code>$val</code> variable? </p>