php - Display html in echo statement -


this question has answer here:

ok below information works im trying figure problem if displays title grade...

but want put | inbetween this

title | grade.

my below code works if there no grade still echos |,

how can echo when there value in field.

because when field empty shows

title |

<div class="sto-info"> <span><?php echo $title; ?> <?php echo '|', $grade; ?></span> </div> 

you can use ternary operator:

<span><?php echo $title; ?> <?php echo $grade ? '|' . $grade : ''; ?></span> 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -