PHP - If variable is not empty, echo some html code

isset will return true even if the variable is "". isset returns false only if a variable is null. What you should be doing:

if (!empty($web)) {
    // foo
}

This will check that he variable is not empty.

Hope this helps


Simply use if ($web). This is true if the variable has any truthy value.

You don't need isset or empty since you know the variable exists, since you have just set it in the previous line.


if (!empty($web)) {
?>
    <span class="field-label">Website:  </span><a href="http://<?php the_field('website'); ?>" target="_blank"><?php the_field('website'); ?></a> 
<?php
} else { echo "Niente";}

http://us.php.net/manual/en/function.empty.php