table = commerc
fields id, name, brand, region, district, provincia, categoria
I need that when consulting the regions, I bring the records and can select through a checkbox the districts and provinces of the selected regions.
How would the call to my database be?
$consulta_estados_visa = $con->query(
"SELECT commerce_id, commerce_region, commerce_brand
FROM commerc
WHERE commerce_brand = 'visa'
GROUP BY commerce_region"
);
This is my code for calling the database.
This is how I bring the regions registers
<?php while($row = $consulta_estados_visa->fetch_assoc()) { ?>
<label class="list d-flex">
<?php echo $row['commerce_region'] ?>
<input type="checkbox" value="<?php echo $row['commerce_id'] ?>" name="estado[]"
/>
</label>
<?php } ?>