A CGI program is invoked in one of two ways:
It is started in response to a form being submitted, via the <FORM ACTION="CGI_program_name.cgi" ...> HTML tag.
In this case, the METHOD="..." attribute of the FORM tag determines how the data is delivered to the CGI program. For "METHOD=post", the data is available on standard input; for "METHOD=get", the data is available in the URL and in the QUERY_STRING environment variable [see the section called Environment Variables].
It is started in a manner similar to the server-side include mechanism of some web servers, and invoked upon loading of the web page.
In either case, the CGI program has a standard method of communicating with the web server and web browser: standard input, standard output and the environment variables. In the case of CGI programs invoked using the server-side-include mechanism, since no form was submitted, there is no form data to process and thus no form data will be given to the program. However, environment variables are still available, and are most useful to the server-side-include-invoked CGI program.