php code to display none?
I'm sure this is fairl开发者_JS百科y simple but I really don't get php is there a way to have the below code to display none if there's no url details entered?
<div class="details">
<h3>web</h3>
<div>URL: <span><a href="<?=$website_url?>"><?=$website_url?></a></span></div>
</div>
Thanks
Wrap it in an if statement.
<? if($website_url): ?>
<div class="details">
<h3>web</h3>
<div>URL: <span><a href="<?=$website_url?>"><?=$website_url?></a></span></div>
</div>
<? endif;?>
EDIT
This might be better:
<?php if($website_url){ ?>
<div class="details">
<h3>web</h3>
<div>URL: <span><a href="<?php echo $website_url; ?>"><?php echo $website_url; ?></a></span></div>
</div>
<?php } ?>
精彩评论