2
Good people, I have a question because I was a little "stuck" not knowing how to do it. I have the following code:
<?
foreach($data as $index => $row) {
$className = $index % 2 == 0 ? "class" : "class-1" ?>
<form action="" name="Insert" method="post">
<div class="selector">
<input name="selector[]" class="selector" type="checkbox" value="<?php echo $row['ID']; ?>" />
</div>
<div id="add-bars" class="<? echo $className ?>">
<img src="<? echo $row['image']; ?>.png" class="img-responsive"/>
<h6>
<? echo $row['Title']; ?>
</div>
</h6>
</div>
<?
}
?>
<div class="btn-padding">
<div class="btn-group dropup pull-right">
<button type="button" class="btn btn-primary">Seleciona uma acção</button>
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
<li><a href="" class="selectall-button" onClick="return false;">Selecionar tudo / Nao selecionar</a></li>
<li class="divider"></li>
<li><a href="#" type="submit" class="delete-button" id="games-delete-button" onclick="javascript:document.InsertGame.submit();">Eliminar</a></li>
</ul>
</div>
</div>
</form>
<?
$edittable=$_POST['selector'];
$N = count($edittable);
for($i=0; $i < $N; $i++)
{
$result = $db->prepare("DELETE FROM table WHERE ID= :ID");
$result->bindParam(':ID', $edittable[$i]);
$result->execute();
}
}
?>
My question is.. When I have no data in the database how do I put a text on the page saying: no data and take out the options box?
You want to remove only the checkboxes?
– touchmx
I want you to take this div
btn-padding
and puts a text saying:sem dados
– thecreator