Re: Avoiding blank lines in HTML when field is empty
| From: | Chris Shiflett | Date: | Thu, 23 Oct 2003 18:41:49 +0000 |
| Subject: | Re: Avoiding blank lines in HTML when field is empty | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167333@lists.php.net to get a copy of this message | ||
--- Robb Kerr <rkerr@digitaliguana.com> wrote:
> Here's the problem. Some of the fields are empty (for instance
> 'Address') and the way my code is configured a blank line appears in
> the returned data when the field is empty. How do I change this code
> to add a conditional that only echos the field contents AND the <br>
> when the field is NOT empty?
if (!empty($foo))
{
echo $foo . '<br />';
}
Hope that helps.
Chris
=====
My Blog
http://shiflett.org/
HTTP Developer's Handbook
http://httphandbook.org/
RAMP Training Courses
http://www.nyphp.org/ramp