0
I have a field input
of the kind date
I want every time I click and view it generates a select with the date query I have set and generate a new input to add another date and so on.
My code so far:
HTML FORMULARIO
<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 don’t know how to generate the foreach and querys why every time I add a new date with the reports will generate a new foreach.
How to do?
And how would I do the querys and foreach? About AJAX I know I would have to enter but I don’t know how to generate the queys and foreach.
– Everton Figueiredo
See the update @Evertonfigueiredo
– Alex
Now I think I can only have a doubt rsrs how do I make the variable not repeat?
– Everton Figueiredo
Guy when I add the new input that submit the new input the previous one with the data will not be lost?
– Everton Figueiredo
...innerHTML += response;
the += here takes what was before and adds up what will be inserted.– Alex