11 / 61

CGI + HTML

#!/usr/bin/perl -w
use strict;

use CGI;

my $cgi = CGI->new;
print $cgi->header;

if ($cgi->request_method eq 'POST') {
    do something;
    print <<'END_OF_HTML';
<html>
<head>
<title>Thank you!</title>
</head>
<body>
Thank you very much for registering!
You will receive a confirmation by email
soon.
</body>
</html>
END_OF_HTML
} else {
    print <<'END_OF_HTML';
<html>
<head>
<title>Register</title>
</head>
<body>
Fill in these fields:<br>
Preferred user name: <input type=text name=user><br>
Password: <input type=password name=pass><br>
Again: <input type=password name=pass>
<hr>
Name: <input type=text name=name><br>
Address: <input type=text name=address><br>
Zip code: <input type=text name=zip><br>
City: <input type=text name=city>
<hr>
Phone number: <input type=text name=phone><br>
Email address: <input type=text name=mail><br>
Homepage URL: <input type=text name=url>
<hr>
<input type=submit value="Send request">
</body>
</html>
END_OF_HTML
}