php - Why isn't this simple IF statement not working? -


i can't script work nothing. tried many different ways make work it's not working.

<?php  if (!empty ($image->alttext )) : ?> <div class="thumbtitle"><?php echo $image->alttext ?></div> <?php endif; ?> 

any appreciated!

it shows true there alttext when there isn't sometimes.

your question vague try following

<?php  if (strlen(trim($image->alttext)) > 0) : ?>     <div class="thumbtitle"><?php echo $image->alttext ?></div> <?php endif; ?> 

as said string not empty whitespaces. use var_dump() or strlen() find out. trim remove whitespaces.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -