4
I have a table where I store the customer payments and between the columns are these two:
And the listing is that way:
<?php
for($p = 1; $p <= $visualizarR[1]->QtdParcelas; $p++){
$botao = ($visualizarR[1]->QtdParcelasPagas == 0)?'<button class="btn btn-danger btn-mini" onclick="window.location.href=\'confirmar-pagamento/?'.$peVisualizar->IdCodPagamento.'\';">Aberto</button></div>':'<button class="btn btn-success btn-mini">Pago</button></div>';
echo '<div style="padding: 10px">'.$p.'º Parcela: '.$botao;
}
?>
When the user clicks on the button Open, he includes in the field QtdParcelasPagas
value 1 and count against existing values. So far so good, but I need to change the button Open for Paid as it is slaughtering the plots, but without reducing the number of plots listed, changing only the value of the button. How can I do this?
makes an if inside is to check if the installment has already been paid, if it has been paid you will print a different button
– Wees Smith
Hello Wees. I’ve tried using a ternary operator but it didn’t work.
– user24136
Hello Fox! Which variable identifies when the installment has been paid or is open? It is with it that you should work to put one thing or another.
– Sam
Hello Sam. I made a change to my post using the variable
$visualizarR[1]->QtdParcelasPagas
of the installment paid using the button.– user24136
I got it. Just one question: let’s say there are 4 installments and only 1 pays, so this 1 must be the first, right? can’t it be the second or the third or the fourth? That’s because the variable
$visualizarR[1]->QtdParcelasPagas
gives only the amount of installments paid, and which (or which) was paid.– Sam
vc uses some identifier for the plots?
– Wees Smith