spacepoet Posted January 31, 2011 Share Posted January 31, 2011 Hello: I have this bit of code in the works (which does not work): <?php if ( $mySubHeader; != "" ) { echo " <h2> <?php echo $mySubHeader; ?> </h2> "; } What I am trying to do is to show the H2 tag only if it has a value from the database. Otherwise, I do not want to show it. What is the correct way to do this? Thanks. Quote Link to comment Share on other sites More sharing options...
litebearer Posted January 31, 2011 Share Posted January 31, 2011 Perhaps... if(trim($mySubHeader) != "" ) { echo " <h2>" . $mySubHeader . "</h2>"; }else{ /* do something else */ } Quote Link to comment Share on other sites More sharing options...
spacepoet Posted January 31, 2011 Author Share Posted January 31, 2011 Perfect! I did this: <?php if(trim($mySubHeader) != "" ) { echo "<h2>" . $mySubHeader . "</h2>"; } ?> Just what I needed. Thanks much! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.