
darian
Deleted
Apr 4, 2000, 1:41 AM
Post #2 of 3
(308 views)
|
|
Re: help!!! - output into html
[In reply to]
|
Can't Post
|
|
First off please be more explicit in what you are looking for. The more info the easier it is to help. Second to print out an html page you need to use this: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> open(FILE, "test.html") or die("$!"); while (<FILE> ) { print $_; } close(FILE); </pre><HR></BLOCKQUOTE> Now if you are looking to just add some lines to an existing file you do this: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> #!/usr/local/bin/perl use CGI qw(:cgi); use CGI::Carp qw(fatalsToBrowser); $in = new CGI; $text = $in->param('text'); open(FILE, ">>test.html") or die("$!); print FILE "$text"; close(FILE); print "Location: $return\n\n";</pre><HR></BLOCKQUOTE> Don't use the <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> print "Content-type: text/html\n\n";</pre><HR></BLOCKQUOTE> line above the <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> print "Location: $return\n\n";</pre><HR></BLOCKQUOTE> line. This will simply print out that line replacing the $return with the url you specified. If you need to use this line after the header then call it in it's own sub. <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> &go_url; sub go_url { print "Location: $return\n\n"; }</pre><HR></BLOCKQUOTE>
|