Automatically generate a dropdown menu from my database

0

Code

<?php
include_once 'includes/dbhinc.php';
$sqlc1="SELECT camada1_name, camada1_id from camada1";
$sqlc2="SELECT camada2_name, camada1ref from camada2
inner join camada1 on (camada1.camada1_id)=(camada2.camada1ref)";

$resultc1 = $conn->query($sqlc1);

while($row = $resultc1->fetch_assoc())
{
    $utfEncodedArray = array_map("utf8_encode", $row);

    //  echo '<li><a href=profile.php>',$utfEncodedArray['camada2_name'],'</a></li>';
    echo'  <li>
    <label for="drop-1" class=toggle>',$utfEncodedArray['camada1_name'],'</label>
    <a href="#">',$utfEncodedArray['camada1_name'],'</a>
    <input type="checkbox" id="drop-1"/>';
    //  echo'<ul><li><a>',$blyat['camada2_name'],'</a></li></ul></li>';
}

What I want and basically generate all "layer1" as a button and through these buttons do a "dropdown" of "layer2", I tried several code, and I do not know what I'm doing wrong. p>

My database

    
asked by anonymous 29.04.2018 / 21:25

0 answers