title: edit select option values
body: <p>I am trying to edit my form. I want to get selected value selected in selection list. </p>
  
  <p>I have created function to store values in database, and it works. Below is html code I use and function below to insert values in database. </p>
  
  <p>// insert values in database</p>
  
  <pre><code>&lt;label&gt;Dobavljač&lt;/label&gt;
  &lt;select class="form-control" name="dobavljac" required&gt;
  &lt;?php dobavljac() ?&gt;
  &lt;/select&gt;
  
  function dobavljac(){
  $sql=mysqli_query($link, "SELECT * FROM `partneri` WHERE `Dobavljac`='1'
  order by `PartnerId` asc "); 
  echo '&lt;option value=""&gt;Izaberi dobavljača&lt;/option&gt;';
      while($record = mysqli_fetch_array($sql)) {
              echo '&lt;option value= "' .$record['PartnerId']. '"&gt;' . $record['PartnerNaziv'] . ' &lt;/option&gt;';
          }
  }
  </code></pre>
  
  <p>// edit values
  First I retrieve information from database</p>
  
  <pre><code>$id=$_GET['id'];
  $sql = "SELECT * FROM materijali where Id=$id ";
  $q = $conn-&gt;query($sql);
  $r = $q -&gt;fetch();
  if ($r) {
  $dobavljac=$r['Dobavljac'];
  </code></pre>
  
  <p>I want to get selected value in box </p>
  
  <pre><code>&lt;label&gt;Dobavljač&lt;/label&gt;
  &lt;select class="form-control" name="dobavljac" value="&lt;?php echo $dobavljac; ?&gt;"&gt;
  &lt;?php dobavljac() ?&gt;
  &lt;/select&gt; 
  </code></pre>
  
  <p>Probably I am not doing it the right way, any advice would be appreciated</p>