CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Why is this text, not html?

 



rainbowz
Deleted

Jun 5, 2001, 4:55 PM

Post #1 of 5 (1043 views)
Why is this text, not html? Can't Post

OK, I'm really puzzled... I'm running this script and I'm getting a strange output.

There are other subroutines in this script, like one to say "You are missing a password" which displays the webpage result as expected (graphic, black backgound, white type, formatting, etc). Then when all the fields are filled in as we want, it should go to this sub which sends them an email, sends a short email to the admin and SHOULD pump out a regular formatted HTML page. But it doesn't - the email messages are sent fine, but the page I get is a raw text version of the source code. The content line is there, just like in all the other subs that work, but for some reason the browser doesn't see it as html.

Any clue why this is coming out as a text page? Am I overlooking something really obvious here? Here's the code for the sub:


Code
sub close { 

#################################################################
## MAIL TO VISITOR ###############################################
#################################################################

open (MAIL, "|$mailprog -t")
|| print "Can't start mail program";
print MAIL "To: $INPUT{'email'}\n";
print MAIL "From: $orgmail ($orgname)\n";
print MAIL "Subject: $response_subject\n\n";

print MAIL "=" x 75 . "\n";
print MAIL "Customer Information\n";
print MAIL "-" x 75 . "\n\n";
print MAIL "Username: $INPUT{'username'}\n";
print MAIL "Password: $INPUT{'pwd'}\n";
print MAIL "Email: $INPUT{'email'}\n";
print MAIL "Continent: $INPUT{'continent'}\n";
print MAIL "Country: $INPUT{'country'}\n";
print MAIL "=" x 75 . "\n\n";

print MAIL "Thank you for completing Step 1 of your submission.\n";
print MAIL "You may now proceed to Step 2.\n\n";

print MAIL"\n\n";
close (MAIL);


#################################################################
## MAIL BACK TO ADMIN ###########################################
#################################################################



open (MAIL, "|$mailprog -t")
|| print "Can't start mail program";

print MAIL "To: $orgmail\n";
print MAIL "From: $INPUT{'email'} ($username)\n";
print MAIL "Subject: $signupresponse\n";
print MAIL "-" x 75 . "\n\n";

print MAIL "=" x 75 . "\n";
print MAIL "Customer Information\n";
print MAIL "-" x 75 . "\n\n";
print MAIL "Username: $INPUT{'username'}\n";
print MAIL "Password: $INPUT{'pwd'}\n";
print MAIL "Email: $INPUT{'email'}\n";
print MAIL "Continent: $INPUT{'continent'}\n";
print MAIL "Country: $INPUT{'country'}\n";
print MAIL "=" x 75 . "\n\n";

close (MAIL);

#################################################################
## DISPLAY CONFIRMATION WEBPAGE ##############################
##################################################################




print "Content-type: text/html\n\n";

&header;
print<<EOF;
<CENTER><BR>
<TABLE BORDER="0" WIDTH="400">
<TR>
<TD><CENTER><BR>
<p><FONT FACE="arial, helvetica,verdana">
<FONT COLOR="#FFCC33"><B>FREE PAGE Submission</B></FONT>

<font size="5" color="#FF6666"><b>Status: SUCCESS!</font></FONT></B></P>

<P><FONT SIZE="2" FACE="arial, helvetica, verdana">
Your $orgname account information has been sent in.

Please check your e-mail for further info.

Thank you for your submission.</FONT></P>

<P><FONT SIZE="1" FACE="arial, helvetica,verdana">
Contact
<A HREF="mailto:$orgmail">$orgname</A>
if you need any further assistance.</FONT></P>
<HR SIZE="1">
</CENTER>
</TD></TR></TABLE></CENTER>
EOF
&footer;
exit;
}

PS: it's not anything in the headers; they work on the other subs - the only difference is that this one sends out a mailing first. At least, I *think* that's the only difference! Maybe someone can spot it...



randor
User

Jun 5, 2001, 5:24 PM

Post #2 of 5 (1040 views)
Re: Why is this text, not html? [In reply to] Can't Post

rainbowz,

just looking at it real quick, my first thought is, try adding the opening <html><title>my title</title> <body> tags before you start into the rest of the html...

I Hope this helps...

perl programmers don't die.. they just start writing a new script.


rainbowz
Deleted

Jun 5, 2001, 6:38 PM

Post #3 of 5 (1038 views)
Re: Why is this text, not html? [In reply to] Can't Post

Randor,

Thanks for the input. However, the header tags are all in there, part of the &header file that it correctly grabs at the begining of the html section:


Code
print "Content-type: text/html\n\n"; 

&header;
print<<EOF;
<CENTER><BR>
<TABLE BORDER="0" WIDTH="400">
<TR>
<TD><CENTER><BR>

etc., etc..

Here's a copy of the actual page it gives out - both the page's source code and the web page itself show exactly the same thing, so it's not picking up that "print "Content-type: text/html\n\n";
" instruction... it's a white page with plain black text, not the black BG and white text the BODY tag calls for.


Code
<HTML><HEAD><TITLE>Free Page request</TITLE></HEAD> 
<BODY BGCOLOR="#000000" TEXT="#FFFFFF" LINK="#FFFFCC" ALINK="#FF3366" VLINK="#FFFFCC">
<center>

<table border="0" cellspacing="0" cellpadding="0" width=500>
<tr>
<td align=center vaign=top colspan=3>
<img src="FP_450_logo.jpg" width=450 height=62 border=0> <CENTER><BR>
<TABLE BORDER="0" WIDTH="400">
<TR>
<TD><CENTER><BR>
<p><FONT FACE="arial, helvetica,verdana">
<FONT COLOR="#FFCC33"><B>FREE PAGE Submission</B></FONT>

<font size="5" color="#FF6666"><b>Status: SUCCESS!</font></FONT></B></P>

<P><FONT SIZE="2" FACE="arial, helvetica, verdana">
Your account information has been sent in.

Please check your e-mail for further info.

Thank you for your submission.</FONT></P>

<P><FONT SIZE="1" FACE="arial, helvetica,verdana">
Contact
<A HREF="mailto:newpages@rainbowzone.com">the admin</A>
if you need any further assistance.</FONT></P>
<HR SIZE="1">
</CENTER>
</TD></TR></TABLE></CENTER>
</BODY></HTML>

As you can see above, the resulting page includes the header's img tag, so that's coming in OK.
Here's another sub that works just fine, header info and all, for comparison:


Code
sub sorder { 

unless ($INPUT{'agree'}) {
print "Content-type: text/html\n\n";
&header;
print<<EOF;
<CENTER><BR>
<TABLE BORDER="0" WIDTH="400">
<TR>
<TD>
<CENTER><BR>
<p><FONT FACE="arial, helvetica,verdana">
<FONT COLOR="#FFCC33"><B>FREE PAGE Submission</B></FONT>

<font size="5" color="#FF6666"><b>Status:You Must Agree.</FONT></B></P>

<P><FONT size=2 FACE="arial, helvetica, verdana">
In order for us to process your request, you must check the box marked
<B>"I agree to the Terms"</B> on our order form.</FONT></P>

<P><FONT SIZE="1" FACE="arial, helvetica,verdana">
Contact
<A HREF="mailto:$orgmail">$orgname</A>
if you need any further assistance.</FONT></P>
<HR SIZE="1">
</CENTER>
</TD></TR></TABLE></CENTER>
EOF
&footer;
exit;
}

What's the difference with these two when it comes to picking up that content line? The content of the source code is exactly what it should be it's just not pumping it out as html on the web page.



wickedxter
User

Jun 5, 2001, 9:40 PM

Post #4 of 5 (1034 views)
Re: Why is this text, not html? [In reply to] Can't Post

put the print <<EOF; & EOF in the header sub

sub header
{
print <<EOF;
#html in here
EOF
}


do it for both

this should fix it..



Mortimer
journeyman

Jun 6, 2001, 7:28 AM

Post #5 of 5 (1026 views)
Re: Why is this text, not html? [In reply to] Can't Post

Before you start printing your html, do...


Code
print MAIL "Content-type: text/html\n\n";

Cheers,
Dave.
www.dmscripts.com
davemortimer@bigpond.com



 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives