2
This displays all the data...
public function getProdutosHome($limit = false){
if($limit == false){
$query = "SELECT * FROM `fretes` ORDER BY id_frete DESC";
}else{
$query = "SELECT * FROM `fretes` ORDER BY id_frete DESC LIMIT $limit";
}
return self::conn()->query($query);
}
How can I filter using checkbox ? every click filter the database data ?
Thank you and sorry for the question.
You will have to do by ajax. Set in each checkbox an onchange by calling the ajax function by picking the selected checkbox.
– Willian Coqueiro
Mor return from ajax, seven the element that will be changed.
– Willian Coqueiro
ok thanks for the tip and it worked. But when I click the checkbox to disable it does not display all the data again. is showing the values that were filtered by checkbox.
– Brasilio Filho
I have to refresh the page to load all the data again.
– Brasilio Filho
Running ajax only when checkbox is checked? It has to be when you have change.
– Willian Coqueiro
$(Document). ready(Function() { $("#Road Train"). on('change',Function() { var value = $(this). val(); $. ajax( { url:'fetch.php', type:'POST', data:'request='+value, beforeSend:Function() { $("#content_products"). html("Filtering..."); }, Success:Function(date) { $("#content_products"). html(data); }, }); });
– Brasilio Filho