<?php
  $sql = "SELECT DISTINCT kategoria FROM kpf_photos ORDER BY kategoria ASC;";
  $result = mysql_query($sql, $link);
  if ($result) {
    $i = 1;
    while ($row = mysql_fetch_assoc($result)) {
      if ($i == $_GET['kat']) 
      echo '            <option value="'.$i.'" selected="selected">'.$row['kategoria'].'</option>';
      else
      echo '            <option value="'.$i.'">'.$row['kategoria'].'</option>';
      $pole[$i]=$row['kategoria'];
      $i++;
      echo '
';      
    }
  }
?>
