-1
I am creating a form and with 2 options one of shopping and another of stores, both already registered within my database, currently in my code independent of the mall I choose in the second options all stores appear and not only those that were registered. What I need is that when I select a mall automatically in the second option just show me the registered stores for this mall and hide the other.
<div class="esquerda">
<label for="shoppingVistoria">Shopping:</label>
<select name="shoppingVistoria" id="shoppingVistoria">
<?php
$consulta = $conectar->query("SELECT razaoSocial, nomeFantasia, CNPJ, pessoaContato, telefone, email, endereco, bairro, municipio, uf, cep FROM shop");
$dadosShop = $consulta->FETCHALL(PDO::FETCH_ASSOC);
$total = $consulta->rowCount();
for ($i=0; $i < $total; $i++) {
echo "<option>" . $dadosShop[$i]['nomeFantasia'] . "</option> ";
}
?>
</select>
</div>
<div class="direita">
<label for="lojaVistoria">Loja:</label>
<select name="lojaVistoria" id="lojaVistoria">
<?php
$consulta = $conectar->query("SELECT nomeFantasia, CNPJ, pessoaContato, telefone, email, shopping FROM loja");
$dadosLoja = $consulta->FETCHALL(PDO::FETCH_ASSOC);
$total = $consulta->rowCount();
for ($i=0; $i < $total; $i++) {
echo "<option>" . $dadosLoja[$i]['nomeFantasia'] . "</option> ";
}
?>
</select>
</div>