Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing HTML in Conditional

Status
Not open for further replies.

pollock77

Programmer
Aug 9, 2004
25
US
Code:
   if($group eq admin) {
      print <<ENDHTML;
         <img src="main.png">
      ENDHTML
   }

I'm getting a 500 error, can I not do this?
 
Yes, this is doable, but...

don't indent the print <<ENDHTML; and ENDHTML lines AND put a blank line AFTER ENDHTML, like this:

Code:
if($group eq admin) {
print <<ENDHTML;
<img src="main.png">
ENDHTML
           <-- blank line here
}

There's always a better way. The fun is trying to find it!
 
Spotted one other thing...

Put quotes around "admin" - if it's a literal.

Code:
if($group eq "admin") {
print <<ENDHTML;
<img src="main.png">
ENDHTML
          
}

There's always a better way.  The fun is trying to find it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top