When selecting a value in the list (green, flowers, breezes, business, all), I need a script to go to the database, select the products table using the list value as Where and fill the table on the page.
I tried with the code below, but I'm not able to apply it correctly, I don't know much about php.
<select name="produto_condominio">
            <option></option>
            <?php while ($reg = $query->fetch_array()) { ?>
              echo '<option value="'.$row['produto_condominio'].'"> '.$row['produto_condominio']. </option>';
            <?php } ?>
          </select>
Full page code:
<?php
$page_title = 'Produtos';
require_once('includes/load.php');
// Checkin What level user has permission to view this page
page_require_level(2);
?>
<?php include_once('layouts/header.php'); ?>
<?php
$con = new mysqli("localhost", "database", "password", "user") or die(mysql_error());
$query = $con->query("SELECT produto_condominio FROM products");
?>
<div class="row">
  <div class="col-md-12">
    <?php echo display_msg($msg); ?>
  </div>
  <div class="col-md-12">
    <div class="panel panel-default">
      <div class="panel-heading clearfix">
        <div class="pull-right">
          <a href="add_product.php" class="btn btn-primary">Adicionar novo produto</a>
        </div>
        <!-- Select por condominio -->
        <div class="pull-left col-md-6">
          <select class="form-control" name="produto_condominio">
            <option value="Selecione">Selecione um condominio</option>
            <option value="Aguas">Aguas</option>
            <option value="Brisas">Brisas</option>
            <option value="Business">Business</option>
            <option value="Flores">Flores</option>
            <option value="Verde">Verde</option>
            <option value="Todos">Todos</option>
          </select>
          <select name="produto_condominio">
            <option></option>
            <?php while ($reg = $query->fetch_array()) { ?>
              echo '<option value="'.$row['produto_condominio'].'"> '.$row['produto_condominio']. </option>';
            <?php } ?>
          </select>
        </div>
        <!-- Select por condominio -->
      </div>
      <div class="panel-body">
        <table class="table table-bordered">
          <thead>
            <tr>
              <th class="text-center" style="width: 50px;">#</th>
              <th> Nome do Produto </th>
              <th class="text-center" style="width: 10%;"> Condominio </th>
              <th class="text-center" style="width: 10%;"> Fornecedor </th>
              <th class="text-center" style="width: 10%;"> Categoria </th>
              <th class="text-center" style="width: 10%;"> Estoque </th>
              <th class="text-center" style="width: 10%;"> Valor </th>
              <th class="text-center" style="width: 10%;"> Adicionado em: </th>
              <th class="text-center" style="width: 100px;"> Ações </th>
            </tr>
          </thead>
          </tabel>
      </div>
    </div>
  </div>
</div>
<?php include_once('layouts/footer.php'); ?>
BD


 
     
     
    