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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

<body bgcolor="0000FF"> is ignored by perl script 1

Status
Not open for further replies.

meekrob

MIS
Feb 13, 2002
127
US
For some reason I am having a heck of a time changing the background color of the the html output of a perl cgi script I am writing. This:

print &quot;<body bgcolor=\&quot;#0000FF\&quot; text=\&quot;#FFFFFF\&quot; link=\&quot;#FFFFFF\&quot; vlink=\&quot;#FFFFFF\&quot; alink=\&quot;#FFFFFF\&quot;>\n&quot;;

Becomes this:

<body bgcolor=&quot;#0000FF text=&quot;#FFFFFF&quot; link=&quot;#FFFFFF&quot; vlink=&quot;#FFFFFF&quot; alink=&quot;#FFFFFF&quot;>

Notice the missing quote after 0000FF ...

I am very new to both Perl and CGI (I'm using Linux/Apache) so I'm sure there is a simple explanation for this.

Thanks for reading,

Meekrob
 
I found the culprit:

print &quot;<meta http-equiv=\&quot;Content-Type\&quot; content=\&quot;text/html>\n&quot;;


I commented out this line and everything works as expected now. I'm still not 100% sure why, but I do have a similar line above it:


print &quot;Content-type: text/html\n\n&quot;;


I guess that there is some conflict. If anyone can enlighten me please do.

Thanks for reading,

Meekrob
 
The reason why this line doesn't work (print &quot;<meta http-equiv=\&quot;Content-Type\&quot; content=\&quot;text/html>\n&quot;;) is because of the meta-http-equiv= and the single newline at the end of the statement. CGI doesn't know about meta-tags and ignores them. Also, the &quot;Content-type: text/html&quot;; MUST have at least 2 blank lines following the statement, which is represented by \n\n.
There's always a better way...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top