Gossamer Forum
Home : Products : DBMan : Customization :

Not displaying some text if a field is empty - HOW?

Quote Reply
Not displaying some text if a field is empty - HOW?
Hey everybody! here's my problem. I have a graphic site db and I have a field for a link button. This link button gets displayed in the results page as an image.

Question: what's the code, if any, that I can enter that won't display that image if the link button field is empty? Right now it displays, so in records it shows up as a broken image. I don't wanna make it required, because it isn't an important field.

Thanks for the help!
Quote Reply
Re: Not displaying some text if a field is empty - HOW? In reply to
Code:
if ($rec{'fieldname'}) {
print qq|<img src="$rec{'fieldname'}">|;
}

Change fieldname to the name of your field.


------------------
JPD





Quote Reply
Re: Not displaying some text if a field is empty - HOW? In reply to
Thanks so much, it worked - of course!
I knew it was something simple, but I'm still learning to hack the CGI. Thanks again!
Quote Reply
Re: Not displaying some text if a field is empty - HOW? In reply to
No problem. Smile Glad I could help.



------------------
JPD