jeudi 9 février 2017

Hide html when included inside php if condition

I would like to present some php with the help of html formatting.

My purpose is to print:

Life status: dead (1850 in New-York)

or (if not dead):

Life status: alive

The place and date should only by printed if the condition $life_status is set to "dead".

The following code works for the dead situation but not for the alive one.

<h3>Title</h3>
<ul>
    <li>Life status: <?php echo $life_status;?>
    <?php if($life_status="dead"):?>
        (<?php echo $date_death; ?> in <?php echo $place_death; ?>).
       </li>
    <?php endif; ?>
</ul>

For the alive sitation, I obtain:

Life status: Alive ( in ).

How can I applied the php condition on "( in)."?

Aucun commentaire:

Enregistrer un commentaire