Printing Html in CGI

by on October 10th, 2007

Examples of printing HTML in CGI scripts.

Simple html output from cgi script
#!/usr/bin/perl -wt
print "Content-type: text/html\n\n";
print "<html><head><title>Hello World</title></head>\n";
print "<body>\n";
print "<h2>Hello, world!</h2>\n";
print "</body></html>\n";
HTML in CGI Second Example
#!/usr/bin/perl -wt
print "Content-type: text/html\n\n";
print <<EndOfHTML;
<html><head><title>Test Page</title></head>
<body>
<h2>Hello, world! This is cgi and html printing</h2>
</body></html>
EndOfHTML
print end_html;
Download Script

Download Example

Leave a Review

Searches for Topic