Tag FORM

Description
Tag <FORM> defines the form on the web page. The form is aimed for data exchange between user and server. The area of use is not limited by sending data to the server. You may get an access to the form via client’s scripts, you may also change it or use it your own way.
The document may involve any number of forms, but only one form can be sent to server simultaneously. That is the reason they must be independent.
The button Submit is used for sending the form to the server. If the button Submit is absent in the form, the button <ENTER> imitates its use, but only in case there is only one element <INPUT> in the form.
Data administration is transferred to CGI program, while the form is sent to the server. CGI program is defined by action parameter of the tag <FORM>. Browser prepares the information as a pair “name-value”, where the name is defined by name parameter of the tag <input>, and the value is entered by user or set in the field of the form by default.
<form action="..."> ... </form>
Parametrs
Action address of CGI program or a document, which handle the forms.
Enctype MIME-type of the form’s information.
Method method of HTTP protocol
Name name of a form
Target name of a window or frame, where the handler will download the returned address.
Closing tag
Is optional
The Description of Tag <FORM> Parameters
ACTION Parameter
Description
It is defined by the handler the form data appeal to, while sending to the server. CGI program or HTML document can work as a handler, but only in case HTML document includes server scripts (Parser, for instance).
If the ACTION parameter is absent, the active page is reloaded and returns all elements of the form to their values by default.
<form action="URL">...</form>
Arguments
Full or relative way to the server file is taken as a value (URL).
Optional parametr
Yes
Default value
No.
ENCTYPE Parameter
Description
Defines MIME type for data, which are sent with the form. Setting of the enctype parameter is not optional usually. But if the field for sending the file is used (INPUT type=”file”), you should define enctype parameter as multipart/form-data.
<form enctype="MIME-type">...</form>
METHOD Parameter
Description
Parameter informs the server about the way of request
<form method="get | post">...</form>
Arguments
The value of METHOD parameter does not depend on the case. There are two methods – GET and POST.
GET
This method is one of the most widespread and aimed for receiving the necessary information and data transfer in the address line. The pairs “name=value” are added to the address after the question mark and separated from each other with an ampersand (&).
POST
This method sends data to the server in the browser request. It allows sending the greater number of data than it is available for GET method, because the last one has limitation in 4 kb.
Optional parametr
No
Default value
Get.
<form>...</form>
Arguments
The number of symbols is used as a name, including numbers and letters. JavaScript is case sensitive that is why follow the same spelling as in the name parameter.
Optional parametr
No
Default value
No
TARGET Parameter
Description
After the handler receives data, it returns the result as HTML document. You may define the window the final web page will be downloaded to. Target parameter is used for this, and the name of the window or frame is used as its value. If the target parameter is not defined, returned address is shown in the active window.
<form>...</form>
Arguments
The name of a window or a frame is used as an argument. It is defined by name parameter. If the null name is defined, a new window will open. The following names are used as reserved:
_blank downloads the page to the new browser window.
self downloads the page to the active window.
_parent downloads the page to the parent frame, in case there are no frames, this parameter works as _self.
_top cancels all frames and downloads the page to the full browser window. In case there are no frames, this parameter works as _self.
Optional parametr
No
Default value
Self
Web forms
PHP form
Form creator
CSS forms