title: Displaying data with php depending on what is selected in select option
body: <p>Is it possible to display data of the current selected option, from <code>mysql</code> using <code>php</code> only?. So my <code>select option</code> works fine and it displays good results. But I want 2 other <code>form-group</code> <code>divs</code> to display data depending on what is currently selected in <code>select option</code>. Is that possible using <code>php</code> only or is <code>javascript</code> necessary?</p>
  
  <p>Html</p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;label for="naslov"&gt;Naslov&lt;/label&gt;
      &lt;input type="text" class="form-control" id="naslov" name="naslov" value="&lt;?php echo $titedit; ?&gt;"&gt;
  &lt;/div&gt;
  
  &lt;div class="form-group"&gt;
      &lt;label for="oglas"&gt;Sadržaj&lt;/label&gt;
      &lt;textarea class="form-control" id="oglas" name="oglas" rows="5" &gt;&lt;?php echo $contedit; ?&gt;&lt;/textarea&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>PHP</p>
  
  <pre><code>&lt;?php
  session_start();
  include_once("db.php");
  
  $sql = "SELECT * FROM news";
  $query = mysqli_query($conn, $sql);
  $title = $row['title'];
  $mxnr = mysqli_num_rows('$query');
  
  
  if ($mxnr &gt; 0) {
  
      echo '&lt;select class="form-control"&gt;';
  
      $counter = 1;
  
      while($row = mysqli_fetch_array($query)) {
  
  
          if($counter == 1){
              echo '&lt;option ' . ($counter == 1 ? 'selected' : '') . ' value="opt' . $counter . '"&gt;' . $row["id"] . '. ' . $row["title"] . '&lt;/option&gt;';
              $titedit = $row['title'];
              $contedit = $row['content'];
  
          }else{
              echo '&lt;option value="opt' . $counter . '"&gt;' . $row["id"] . '. ' . $row["title"] . '&lt;/option&gt;';
          }
  
          $counter++;
  
      }
  
      echo '&lt;/select&gt;';
  
  } else {
      echo "0 results";
  }
  ?&gt;
  </code></pre>