Show DIV according to condition in PHP

2

I have a div that brings a select of the bank, but it can only be shown if it meets a condition. It comes like this:

<div id="conteudo" style="display: none;">

If it meets this condition: if (get('data_do_descredenciamento') != '') , then the div display should change to style="display: show;" .

How can I mount this condition in PHP?

    
asked by anonymous 01.08.2016 / 18:19

1 answer

6

Option 1:

<div style="<?php echo get('data_do_descredenciamento') != '' ? 'show' : 'none'; ?>">
</div>

Option 2:

<div style="<?php if (get('data_do_descredenciamento') == '') { echo 'display: none;' }">
</div>

Option 3:

<?php if (get('data_do_descredenciamento') != '') { ?>
    <div>
    </div>
<?php } ?>
    
01.08.2016 / 18:24