Forms


Forms are used for sending data to CGI -script. CGI -script is program that handles data sent by form. Most often forms are used for submitting queries to search engines, post e-mail or to get feedback from users.

Form starts with <FORM> and ends with </FORM>. All other elements are allowed inside form element execpt another form.

Example of form start tag:
<FORM METHOD=POST ACTION="http://www.uta.fi/cgi-bin/mailform?litera>, where attribute METHOD tells how data is sent to script. Possible METHOD values are GET and POST. ACTION attribute tells where is the script that handles data.

User can write text or give values by INPUT fields in form. Common INPUT TYPEs are:


Example form code:

<FORM ACTION="http://www.uta.fi/~cgi-bin/mailform&litera" METHOD="Post">
Your name is: <INPUT TYPE=TEXT NAME="name_is"><BR>
If you are student check this: <INPUT TYPE=CHECKBOX NAME="student">
Where are you from:<BR>
<INPUT TYPE=RADIO NAME=FROM VALUE="Tampere"> Tampere<BR>
<INPUT TYPE=RADIO NAME=FROM VALUE="Some other place"> Some other place<BR>
I am interested in : <SELECT>
<OPTION> HTML
<OPTION>SGML
</SELECT><BR>
My message : <TEXTAREA NAME="text" ROWS=2 COLS=40></TEXTAREA>
</FORM>


Example form according to previous code:

Your name is:
If you are student check this:
Where are you from:
Tampere
Some other place
I am interested in :
My message :
My e-mail form
and content of the example message