How does the CGI work

When you press a link:

then the CGI console (strawberry) on our server is executed. It starts the prolog program and passes to it arguments Arg1, Agr2, Arg3 and so on. As a result of the work of this prolog program a HTML file is generated and this HTML file is what you see as the result.

You can make an easy example. Write the program:
  write(" ").
This program will work but its output is empty HTML. Take one HTML file and paste it between the quotes (you have to replace " with "" in the HTML file). The new program which you have just created will write your HTML as its output.

If you like you can see the source of these Prolog CGI Scripts:

If you want to learn more about CGI Scripts you can visit this page.