0
I have the following table:
<table width="100%" class="table table-bordered table-hover table-responsive table-striped" id="empenho_solicitante">
<thead>
<tr> <th colspan="5"> +---------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+</th> </tr>
<tr> <th colspan="2"> FIN503 - CONTABILIDADE PUBLICA </th> <th colspan="3"> RELATORIO DE EMPENHOS POR SOLICITANTE</th> </tr>
<tr> <th colspan="2"> PREFEITURA MUNICIPAL DE ITABIRA </th> <th colspan="3"> NO PERIODO DE <?php echo $dataIni." À ".$dataFim ?> </th> </tr>
<tr> <th colspan="5"> +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ </th> </tr>
<tr> <th colspan="5"> SOLICITANTE: <?php echo $cod_orgao.".".$cod_unidade." - ".$unidade; ?> </th> </tr>
<tr> <th colspan="5"> +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ </th> </tr>
<tr>
<th>Empenho</th>
<th>Programatica</th>
<th>Conta Desp.</th>
<th>Credor</th>
<th>Valor</th>
</tr>
</thead>
<tbody>
<?php
while ($linha = sqlsrv_fetch_array($resultado))
{
?>
<tr class="odd gradeA">
<td align = "right"> <?php echo $linha["num_empenho"]; ?> </td>
<td align = "center"> <?php echo $linha["programatica"]; ?></td>
<td align = "center"> <?php echo $linha["conta_desp"]; ?></td>
<td align = "left"> <?php echo $linha["nome_fornecedor"];?></td>
<td align = "right"> <?php echo
number_format($linha["valor_empenhado"], 2, ',', '.');
$total += $linha["valor_empenhado"];
?></td></tr>
<?php
}
?>
<td colspan="4" align = "middle"> <?php echo "Valor empenhado para este solicitante no período:" ?> </td>
<td> <?php echo number_format($total, 2, ',', '.'); ?> </td>
</tbody>
</table>
and would like it to appear only after I press this button here:
<input type="submit" id="consultar" value="Consultar" /><br>
Currently the table is fixed on the page, so when I open it already appears, but I would like it to be presented only after 4 fields are filled and the query button is triggered.
Table data I receive from a BD, but I believe there is no need to post the query.
I’m developing an example for you of how to do this, but before that I’d like to warn you that near
$linha["programatica"]
you have a syntax problem, a php closure that should be?>
and is like>
, and also close to$linha["nome_fornecedor"]
you tme atd
not closed properly:/td>
– Paulo Roberto Rosa
I must have deleted it at the time I was arranging the code here, because it is working 100% so far, thanks for the remark @Pauloroberto
– V.Avancini
Create the table or show the table after clicking the button?
– user60252
If the table will modify every click on the button, it should be mounted via Ajax.
– Sam
Please correct the question title if the problem is showing the table and not creating it. Explain better what you want to happen and what currently happens
– Paulo Roberto Rosa
@Pauloroberto , I corrected the title and increased with the information you requested
– V.Avancini
@Leocaracciolo is to show the table, corrected the title
– V.Avancini
Blz, don’t forget to dial as
aceita
the answer that solved your question, see how and why in https://pt.meta.stackoverflow.com/questions/1078/como-e-por-que-aceitar-uma-resposta/1079#1079– user60252
good, for now none solved, so I did not mark as accepted, but I am debating here still, there was one that came next hahaha but it did not go all right
– V.Avancini