title: How to set default value of a select dynamically from database using smarty?
body: <p>I have a <code>select</code> like this:</p>
  
  <pre><code>&lt;select class="fruitsSelect" name="fruits"&gt;
     &lt;option value="Apples"&gt;Apples&lt;/option&gt;
     &lt;option value="Bananas"&gt;Bananas&lt;/option&gt;
     &lt;option value="Oranges"&gt;Oranges&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>And I know that you can set a default value if you use <code>selected</code> attribute.</p>
  
  <pre><code>&lt;select class="fruitsSelect" name="fruits"&gt;
        &lt;option value="Apples"&gt;Apples&lt;/option&gt;
        &lt;option value="Bananas" selected&gt;Bananas&lt;/option&gt;
        &lt;option value="Oranges"&gt;Oranges&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>But what I am trying to do is that, from a value that I retrieve from my database (I send it to <code>HTML</code> via <code>PHP</code>) the option that I retrieve from my database would be the <code>selected</code> option (the default option).</p>
  
  <p>I have the value on my HTML but I do not know how to make it be the selected option because it can change. I am using <code>Smarty</code> and trying to make some ifs statements but I cannot get it out.</p>
  
  <p>How can I compare the value that I retrieve from my database with the value of the <code>select</code> and make it to be the selected option?</p>
  
  <p>Thanks in advance!</p>