mercredi 28 août 2019

If field = a echo... else

On a report, I'm trying to show a signature depending on the value of a field. So, I'm adding php inside html.

<?php

if ($lawyer == "DS") {
    echo '<div class="signature">
<p class="boldcentrado">
E.D.</br>
Lawyer</div>
<div class="assinaturacaixa">
<p class="boldcentrado">DS</p>
</div>';
} else {
    echo '<div class="signature">
<p class="boldcentrado">
E.D.</br>
Lawyer</div>
<div class="assinaturacaixa">
<p class="boldcentrado">PM</p>
</div>';
}
?>

If field "lawyer" equals "DS", it should "show":

<div class="signature">
<p class="boldcentrado">
E.D.</br>
Lawyer</div>
<div class="assinaturacaixa">
<p class="boldcentrado">DS</p>
</div>

if it's any other value, show:

<div class="signature">
<p class="boldcentrado">
E.D.</br>
Lawyer</div>
<div class="assinaturacaixa">
<p class="boldcentrado">PM</p>
</div>

Problem is it's always showing the first option, no matter the field value.

Aucun commentaire:

Enregistrer un commentaire