I have a search with several checkboxes that can be selected and added dynamically by the user. As I do not know the quantity, I was thinking of doing the following: go through all of them and go concatenating with AND
and use that in the condition there in the search.
The problem is that the way I did it ends up getting a AND
alone at the end of the search. Here is my code:
$Busca = $_POST['txtbusca'];
$arrayFiltro = $_POST['chkDisciplina'];
for ($i=0; $i < count($arrayFiltro); $i++) {
echo $arrayFiltro[$i]. "AND";
}
Is there a better way?