This is one of those "universal mistakes" so don't feel bad about making it. A web-page like this is a computer program: what you enter is fed to it as input and what you get is its output. The web server must be configured to recognize that such-and-such URL corresponds to a program. If it doesn't, then "it serves the content of a file," no matter what that content is. (And this, BTW, can be a serious source of security holes.)
Yes, these are my first steps into creating dynamic web pages. I'm happy i found this community because there are lots of things to digest and the Monastery sure is a place of knowledge.