title: Populate dropdown from database and set default value
body: <p>Right now I have a working solution for populating an HTML <code>&lt;select&gt;</code>/<code>&lt;option&gt;</code>-dropdown with the content through <strong>PHP/MYSQLI</strong> from my <code>database: listoption</code>.</p>
  
  <p>The database:</p>
  
  <pre><code>DATABASE NAME: 
  # listoption
  
  TABLES:
  # ID INT(11) *Primary AI
  # listoption_item VARCHAR(255)
  </code></pre>
  
  <p>Here's the other code (not the mysqli connect but everything afterwards..)</p>
  
  <pre><code>&lt;?php
  
      $result = $mysqli-&gt;query("select * from listoption");
  
      echo "&lt;select id='list' name='list'&gt;";
  
        while ($row = $result-&gt;fetch_assoc()) {
  
          $listoption_item = $row['listoption_item'];
  
          echo '&lt;option value="'.$listoption_item.'"&gt;'.$listoption_item.'&lt;/option&gt;';
  
        }
  
      echo "&lt;/select&gt;";
  
  ?&gt;
  </code></pre>
  
  <p>But the problem is now that I want to have one of these options that are populated through that query to be <code>selected</code>. And the option to be selected should be determed by a parameter in the URL, for example: <code>index.php?id=1</code>.
  So now I need to somehow add a IF/ELSE and a <code>$_GET['id'];</code> into the code to make it identify if the ID from the database is the same as the populated item and then set it to selected. </p>
  
  <p>Any idéas? Thanks!</p>