When writing a CGI script, it's very important to be careful about the use of print statements. When the script is invoked by a request from a browser,
everything that is output via
print statements in the script will be sent back to the browser.
So, you want to make sure that you start with a valid HTTP header, then print a valid and complete html sequence (starting with <HTML> and ending with </HTML>).
The CGI module has functions for making this easier and more manageable -- and as mentioned in an earlier reply, there are also functions for creating input methods on the web page, and for handling the query parameters that come back in the request from the form.
Please look at the example code provided near the beginning of the CGI manual for guidance. Then look at how print is being (mis)used in the code you posted: your code never prints the http header (the CGI "header" function), and is printing some html content (and some non-html content) before doing print "<html>..." -- that won't work.
As suggested above, get the http/html stuff working on its own first, then add the mysql stuff.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.