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

Netscape & Firefox display HTML code rather than as a web page

Status
Not open for further replies.

DPROMICS

Technical User
Nov 5, 2003
108
US
The following Perl CGI script displays the web page code quite nicely as a web page on Internet Explorer. However, Netscape 7.x and the current FireFox web browers display the actual HTML code.

OK what needs to be added to the HTML code to get Netscape and Firefox to display it as a web page?

sub check_userid {

# Check if Valid User ID & Password was entered

if ($Form{username} == $validuserid && $Form{password} == $validpassword) {

print <<"(VALID LOGIN HTML)";

<html>
<head>
<title>Successfully Logged in to the Staff Web Page</title>
</head>
<body>
.
.
.

</body>
</html>

(VALID LOGIN HTML)
}
else {

print <<"(INVALID LOGIN HTML)";

<html>
<head>
<title>Did Not Successfully Log in to the Staff Web Page</title>
</head>
<body>
.
.
.
</body>
</html>

(INVALID LOGIN HTML)
}

.
.
.

Best Regards,
 
Hi

They are right. You have to specify the [tt]Content-type[/tt] in the HTTP header, before sending the proper content :
Code:
print "Content-type: text/html\r\n\r\n";

Feherke.
 
Thanks. That resolved the issue. I had tried that earlier but had put it after the:

print <<"(VALID LOGIN HTML)";

as: Content-type: text/html

Rather than as a part of a print before the existing:

print << "( VALID . . .

I was on the right track just on the wrong siding. ;>)

Best Regards,

 
Hi

You can put it inside the here-document, if you wish. Just keep one completely empty line between the HTTP header(s) and the following content.
Code:
print <<"(VALID LOGIN HTML)";
Content-type: text/html

<html>
<head>
<title>Successfully Logged in to the Staff Web Page</title>
</head>
<body>
[gray]...[/gray]
</body>
</html>
(VALID LOGIN HTML)

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top