开发者

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 } ?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜