Forms
HTML Forms have a wide variety of uses on the web. When data needs to be collected and send to a server or an email address, forms must be used. A form can be as simple as a textbox and a submit button, or can be as complex as a complete desktop application.
Every form starts out and ends with the <form> tag. Each element, such as a textbox or a button, are to be contained within the form tags. The most common used attributes for the form tag are method, and action.
The method attribute specifies how to send the data, whether it is a GET or POST request. A GET request appends the form values onto the query string and the POST request sends them without appending the values to the query string. In most cases, the POST method is the preferred method of transmitting form data.
The action attribute is used to specify the location to send the form data. Most of the time this is a server side script on the server, but it can also be an email address prefixed by "mailto:".
The following is an example of how to use the form tag:
<form method="post" action="formpostscript.php"></form>
The HTML <input>, <textarea>, and <select> tags are used to specifiy elements to be used in forms. The uses for each tag are as follows:
Textbox
<input type="text" name="text_name" value="" />
Button
<input type="button" name="button_name" value="A Button" />
<input type="reset" name="reset" value="Clear Form Values" />
<input type="submit" name="submit" value="Submit Form" />
Checkbox
<input type="checkbox" name="checkbox_name" />A CheckBox
A CheckBox
Radio
<input type="radio" name="radio_name" />A Radio Button
A Radio Button
Hidden
<input type="hidden" name="hidden_name" value="" />
File
<input type="file" name="file_name" value="" />
Dropdown
<select name="select_name"> <option value="1">Option 1</option> <option value="2">Option 2</option> <option value="3">Option 3</option> </select>
Multi-Select
<select name="multiple_select_name" multiple="multiple" size="3"> <option value="1">Option 1</option> <option value="2">Option 2</option> <option value="3">Option 3</option> </select>
Textarea
<textarea name="textarea_name" cols="50" rows="4">TextArea Value</textarea>
Popularity: unranked [?]