rdub Posted October 14, 2008 Share Posted October 14, 2008 This code shows the contents of $fetched[agent_email] if the field contains info. If now, it leaves an empty linespace. I'd like it to not leave a space if the field is empty. Thank you. "<br /><a href='mailto:".$fetched['agent_email'] . "'>". $fetched['agent_email'] . "</a>"; Quote Link to comment https://forums.phpfreaks.com/topic/128402-dont-show-blank-fields/ Share on other sites More sharing options...
Zhadus Posted October 14, 2008 Share Posted October 14, 2008 <?php if (isset($fetched['agent_email'])) { echo "<br /><a href='mailto:".$fetched['agent_email'] . "'>". $fetched['agent_email'] . "</a>"; } else { echo "No values in variable."; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/128402-dont-show-blank-fields/#findComment-665285 Share on other sites More sharing options...
CroNiX Posted October 14, 2008 Share Posted October 14, 2008 I would change if (isset($fetched['agent_email'])) { to if (isset($fetched['agent_email']) && !empty($fetched['agent_email'])) { Quote Link to comment https://forums.phpfreaks.com/topic/128402-dont-show-blank-fields/#findComment-665323 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.