A good start is a look at What is good hypertext writing? For technical concerns, the World Wide Web Consortium is the authoritative source. They publicize a number of hands-on tutorials at W3 Schools.
Perl is a common language for CGI scripting; a number of tutorials are available online and can be found via a web search. Python is also a common language of choice.
There is one helpful trick to get useful error messages when writing
CGI scrips in perl. If your code or a module that you call invokes
Perl's die function, it will certainly trigger a 500 Internal Server
Error unless you trap it. Use CGI::Carp to trap fatal calls and redirect
the messages to the browser. Add this line to the top of your script:
use CGI::Carp qw( fatalsToBrowser );

David R. Cheriton School of Computer Science
University of Waterloo
Waterloo, Ontario, Canada N2L 3G1
Tel: 519-888-4567 x33293
Fax: 519-885-1208
Contact | Feedback: isg@cs.uwaterloo.ca | David R. Cheriton School of Computer Science | Faculty of Mathematics