Forms Course


CGI And Mailto:

A form can be sent by using a CGI script or a simple "mailto:" email address code. In order to use a CGI script to send your form, your web page host must have a cgi-bin to upload the CGI script to. If you would like to use this method for your form you can get a free CGI FormMail script. from Matt's Scripts. It is a popular script and easy to configure. Please read Matt's instructions on how to use the CGI script, as we will not be getting into that here.

The First Line Of Code

Which METHOD you use to send your form this will determine what ACTION you will be using. We will first talk about using the CGI script to send your form. Your first line of code for your form will be the opening FORM tag, the ACTION, the METHOD and ENCTYPE. This is true no matter which METHOD you choose to use to send your form.

  • ACTION: This is the URL of your CGI server to which the form contents will be submitted to, or the "mailto:" email address to send the form to.
  • METHOD : This is the method used to submit the completed form to your CGI server. Which method you use depends on how your CGI server works (check with your web page host). GET is the default method, but POST is used more often.

Important Note:POST must be capitalized, otherwise the method defaults to GET.

  • ENCTYPE : This specifies the encoding for the completed form contents. This attribute only applies if METHOD is set to POST.

The default is: application/x-www-form-urlencoded. Most of the time the default is the proper encryption, so you can leave this value out of your code and it will be set by default. Again, check with your web page host if another encryption type is needed.

If you use a CGI script you will have a URL to your cgi-bin to submit the form to. That URL will be used in the ACTION part of the form code.


Here is an Example of a CGI server's URL:

Next add the METHOD. POST is used more often, but check with your web page host to be sure. ENCTYPE set by default. We will use a different ENCTYPE later when we talk about "mailto:" as the ACTION.

So now our first line of code looks like this:


If you choose to use an email "mailto:" as the ACTION, your first line of code will include an ENCTYPE in order to receive the form in a format you will be able to read.

Here is our first line of code as a "mailto:" form with the proper ENCTYPE to send the form.

Note to MSNTV And Computer Users:
If you intend to have MSNTV users submitting your form, you should include ?no_signature=true into your "mailto:" form. This will disable MSNTV's HTML email signatures. MSNTV's HTML email signatures will block all data being sent to you in your form.

Here is our first line of code as a "mailto:" form with the MSNTV code to disable their HTML email signatures.


The Closing FORM Tag

It is a good idea to close your FORM tag at this point. This way you will not forget it because the form will not work without this closing FORM tag.

The closing FORM tag is:


This is how our form code looks at this point. We will be using the "mailto: form for our example form.