List data for the Option

1

I'm trying to list database data for my options, but I do not know how to do this I've tried the following way down there, I want it when the form is submitted I want to send ID to that location, but not select I want to show descrição of that id .

//criei a query = $consulta
  $consulta = "SELECT denuncia.id, data, imagem ,denuncia.descricao, b.descricao as bloco_descricao, doq.descricao as oque_descricao, id_bloco, id_denuncia_oque, qual_descricao, u.matricula, nome, sobrenome FROM denuncia INNER JOIN usuario u ON u.id = denuncia.id_usuario INNER JOIN bloco b ON b.id = denuncia.id_bloco INNER JOIN denuncia_oque doq ON doq.id = denuncia.id_denuncia_oque";
   //prepara a query
   $con = $connection->prepare($consulta);
   //executar o comando sql
   $denuncia = $con->execute();
   //juntar todos os resultados do select em um vetor de arrays
   $denuncia = $con->fetchAll();

Here are my Options

<select select="required" class="form-control" name="id_denuncia_oque" id="sel1" required="required" >
    <option value="" disabled selected>Ex: Laboratório</option>
    <?php  foreach ( $denuncia as $den   )  {  ?>                    
        <option value="<?$den["id_denuncia_oque"]; ?>"> 
            <?php echo $den["oque_descricao"]; ?>
        </option>
    <?php }?>
</select>
    
asked by anonymous 19.10.2018 / 22:45

0 answers