searching the web yields this for a start:
http://httpd.apache.org/docs/howto/cgi.html
be warned, though, that cgi is considered `old-school', and that technologies such as PHP, asp and jsp are the preferred way to create dynamic content. Of course, if cgi is what you want, I won't stop you. But I suggest you look at php first.
Hope this helps,
Jonas Kölker
PS. I think you should read the `smart questions' essay by ESR. Your first task will be to find it, but I'll give you a hint: google.