I have an array with $ c name that I made through a precise explode to do the count with for to see if it is selected. The problem is that it does the echo of option 2 or how many times there are records. Does anyone have a solution for this?
foreach($interesse_compra as $ic)
{
$c = explode(";",$ic->cidade);
}
for($i = 0; $i < count($c);$i++)
{
foreach($cidades as $cidade)
{
$select = $cidade->f_cidade == $c[$i] ? "selected" : "";
echo "<option value='".$cidade->f_cidade."'$select>".$cidade->f_cidade."</option>";
}
}