This tag is required to set up a form. It is a container tag meaning that it has a beginning and an end tag. The contents of the form must fall between the two, like this:
<form action="path to CGI" method="post">
Body of Form including all input fields and the submit button.
The important attributes of the form tag are Action and Method. These are necessary to process the form. The Action attribute should point to the program being used to process the form, in this case "/cgi-bin/form2mail.pl" and the Method tag should be set to "post".
Input tags are used to collect information from the user. Only information put into the input fields will be passed to the CGI program. For best browser support, it is best to include both the name and the id attributes with the same value for all input tags. Also, input tags should be properly closed, meaning they should end with />.
This tag is used to collect short responses such as name and address.
Name: <input type="text" id="name" name="name" size="30" />
will look like Name:
Radio buttons are useful if you want to force a user to choose between two or more options. Only one radio button in a set can be selected. Radio buttons are grouped together by giving them the same name. The value in the "value" attribute will be passed to the CGI program if that button is selected.
<input type="radio" id="Yes_No" name="Yes_No" value="yes" />yes
<input type="radio" id="Yes_No" name="Yes_No" value="no" />no
will look like yes no
The result would look like "Yes_No=yes" if the yes button was selected.
These are used to provide a number of options. More than one can be selected.
Blue <input type="checkbox" id="color" name="color" value="blue" />
Red <input type="checkbox" id="color" name="color" value="red" />
Green <input type="checkbox" id="color" name="color" value="green" />
Yellow <input type="checkbox" id="color" name="color" value="yellow" />
would look like: Blue Red Green Yellow
This tag is used to create a drop down menu. A drop down menu will allow the user to choose between a group of options provided in the list.
<select id="color" name="color">
will look like
This is used to collect a large amount of text from the user, such as you would expect in a comments box. The size of the text area is set by designating the number of rows and columns to be displayed.
comments:<br / >
<textarea name="comment" rows="5" cols="25">
would look like:
Some could argue that the submit button is the most important feature of the form. Nothing is submitted to the CGI until the "submit" button is clicked. The reset button is optional. It allows the user to delete all the information they filled in the form. The button label will read whatever is put in the value field.
<input type="submit" value="Submit my form" /> <input type="reset" value="Reset" /> would look like:
Note: These elements are for instruction only. Nothing will happen if this form is submitted.