in reply to CGI and CSS

Does the webserver show that it is serving the css and image file, or does it show a 404? Are you sure the path is correct? Have you enabled your browsers developer tools to help track down what's going wrong?

On a Perl note I'd suggest you use a template system (HTML::Template/Template) to separate your perl code from the HTML/CSS/JavaScript code. Get the static page working then populate it with your data generated by your perl code. Tutorials->Framework, Templating, and Content Management Systems->HTML::Template Tutorial.

Update:

print "</body>\n"; print "</html>\n";

You end the page then print a table. Print the whole page then close the body and html tags.

You create variables containing database connection details and never use them.

Validate your HTML.

Update 2:

You use data provided user data directly into a SQL query, which can be dangerous. See the DBI documentation on placeholders and bind variables. Also: