SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Dec 2004
    Location
    Cooperstown
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Do not Display HTML if field is NULL

    Here's the code snippet:

    <font class="section_head">Full Bio</font>
    <br>
    <?php echo $content["bioFull"]; ?>

    I don't want the HTML header (or the blank field) to appear if the "bioFull" field in the mySQL DB is NULL.

    I understand I need to take that HTML and place it inside PHP code, using ECHO most likely, but how do I make it disappear if the field is NULL?

    Any suggestions would be greatly appreciated.

  2. #2
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    South Africa
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php
    if (!empty($content['bioFull'])) {
    ?>
    <font class="section_head">Full Bio</font>
    <br>
    <?php 
    echo $content["bioFull"];
    }
    else {
    //print nothing or do something else
    }

  3. #3
    SitePoint Member
    Join Date
    Dec 2004
    Location
    Cooperstown
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    THANKS, that worked perfectly!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •