I have a field input
of type date
I want every time I click and view it, it generates a select with the query of the date that I set and generate a new input to add another date and so on. >
My code so far:
HTML FORM
<form class="form-inline" role="form" style="margin-left: 10px;" action="#">
<div class="form-group">
<label for="relatorio">Visualizar Relatorio: </label>
<input type="date" class="form-control" id="relatorio" name="relatorio">
</div>
<div class="btn btn-success m-l-10" onclick="consulta()">Adicionar</div>
<div class="btn btn-success m-l-10" onclick="">Remover</div>
</form>
HTML RESULTS
<table>
<thead>
<tr>
<th>Cod.</th>
<th>Descricao</th>
<th>Status</th>
<th>Valor</th>
</tr>
</thead>
<tbody>
<?php
foreach ($dia as $b) {?>
<tr>
<td><?php echo $b->id; ?></td>
<td><?php echo $b->descricao; ?></td>
<td><?php echo $b->status; ?></td>
<td><?php echo $b->valor; ?></td>
</tr>
<?php } ?>
</tbody>
MYSQL:
"SELECT *, SUM(valor) as valo FROM pedidos WHERE data LIKE :data GROUP BY 'data' ORDER BY id DESC"
My biggest problem is that I do not know how to generate foreach and querys because every time I add a new date with the reports it will generate a new foreach.
How to do it?