The form tag
The form
tag creates a form for sending data to the server, where this data will be processed using the PHP language. Also, the form data can be processed using the языка JavaScript.
The tag serves as a container for the tags input
, textarea
, select
, button
, fieldset
. The specified tags do not necessarily need to be placed within the form
tag, but if you do not, the form will not be submitted to the server.
The form is sent to the server by clicking on the button created by the tag input
with the attribute type
set to submit
, or on the button button
.
Attributes
Attribute | Description |
---|---|
action |
Where to send the form, to which page of the site (your own or someone else's). If left blank, the form will be sent to the current page. An optional attribute. The attribute can contain a link to a specific place on the page (via # , as in the tag a ). In this case, after sending the form, the browser will open the page specified in the action attribute at the specified location.
|
method |
The form submission method can be POST or GET . The layout designer doesn't need to know this.
Optional attribute. Defaults to GET .
|
target |
Tells the link which tab to open in: a new one, the current one, or a frame.
Optional attribute. |
enctype |
Specifies how form data is encoded.
An optional attribute. For more information, see attribute enctype .
|
Values of the target attribute
Meaning | Description |
---|---|
_blank |
The page will open in a new browser tab. |
_self |
The page will open in the current browser tab. |
_parent |
The page will open in the parent frame. |
_top |
Discards all frames and loads the page in a full browser window. |
Default value: _self
.