Тег FORM

Body and form in html

Тег устанавливает форму на веб-странице. Форма предназначена для обмена данными между пользователем и сервером. Область применения форм не ограничена отправкой данных на сервер, с помощью клиентских скриптов можно получить доступ к любому элементу формы, изменять его и применять по своему усмотрению.

Документ может содержать любое количество форм, но одновременно на сервер может быть отправлена только одна форма. По этой причине данные форм должны быть независимы друг от друга.

Для отправки формы на сервер используется кнопка Submit, того же можно добиться, если нажать клавишу Enter в пределах формы. Если кнопка Submit отсутствует в форме, клавиша Enter имитирует ее использование.

Когда форма отправляется на сервер, управление данными передается программе, заданной атрибутом action тега . Предварительно браузер подготавливает информацию в виде пары «имя=значение», где имя определяется атрибутом name тега , а значение введено пользователем или установлено в поле формы по умолчанию. Если для отправки данных используется метод GET , то адресная строка может принимать следующий вид.

Параметры перечисляются после вопросительного знака, указанного после адреса CGI-программы и разделяются между собой символом амперсанда (&). Нелатинские символы преобразуются в шестнадцатеричное представление (в форме %HH, где HH — шестнадцатеричный код для значения ASCII-символа), пробел заменяется на плюс (+).

Допускается внутрь контейнера помещать другие теги, при этом сама форма никак не отображается на веб-странице, видны только ее элементы и результаты вложенных тегов.

Читайте также:  Timeweb ssh php version

Синтаксис

Атрибуты

accept-charset
Устанавливает кодировку, в которой сервер может принимать и обрабатывать данные. action Адрес программы или документа, который обрабатывает данные формы. autocomplete Включает автозаполнение полей формы. enctype Способ кодирования данных формы. method Метод протокола HTTP. name Имя формы. novalidate Отменяет встроенную проверку данных формы на корректность ввода. target Имя окна или фрейма, куда обработчик будет загружать возвращаемый результат.

Также для этого тега доступны универсальные атрибуты и события.

Закрывающий тег

       

Как по вашему мнению расшифровывается аббревиатура "ОС"?

Офицерский состав Операционная система Большой полосатый мух

Результат данного примера показан на рис. 1.

Рис. 1

Рис. 1. Вид элементов формы в окне браузера

Статьи по теме

Источник

Form Tags in HTML

HTML Form
A section of a document to control text fields, password fields, checkboxes, radio buttons, submit buttons, menus etc. is called and is created by the HTML form. The data thus entered in a form is sent to the server for further processing. Thus collecting some info from the site visitor is easy with the use of the HTML form.

form action="server url" method="get|post"> //input controls e.g. textfield, textarea, radiobutton, button form>

HTML Form Tags:

TAG USES
To specify an HTML form.
To specify an input control.
To specify a multi-line input control.
To specify a label for an input element.
To specify groups for the related element in a form.
To specify a caption for a element.
To specify a drop-down list.
To specify a group of related options in a drop-down list.
To specify an option in a drop-down list.
To specify a clickable button.
To specify a list of pre-defined options for input control.
To specify a key-pair generator field for forms.
To specify the result of a calculation.

HTML element:

The HTML element is used to specify an HTML form. It is a container which provides a document section to take input from the site visitors, along with the various interactive controls for submitting information to the web server.

HTML element:

The HTML element is used to specify an input control to create form fields and to take inputs from the user. It is a fundamental form element in HTML. Different input fields can be applied to gather different information from the site visitors.

DOCTYPE html> html> body> h2>Text Input Exampleh2> form> Name:br> input type="text" name="name"> br> City:br> input type="text" name="city"> form> body> html>

Text Input Example

Name:

City:

Источник

HTML Tag

The tag is used to add HTML forms to the web page for user input. Forms are used to pass the data submitted by the user to the server. The data is sent when pressing the «Submit» button. If there isn’t such button, the information is sent when the «Enter» key is pressed.

If the individual elements inside the

tag are valid you can use the CSS :valid pseudo class for styling the tag, and the :invalid pseudo class, in the case where they are not valid.

Syntax

The

tag comes in pairs. The content is written between the opening ( ) and closing (

) tags.

The element contains other HTML tags, which define the input method of data:

Example of the HTML tag:

html> html> head> title>Title of the document title> head> body> form action="/form/submit" method="GET or POST" > label for="fname">Name label> input type="text" name="FirstName" id="fname" value="Mary"/>br/>br/> label for="lname">Surname label> input type="text" name="LastName"id="lname" value="Thomson"/>br/>br/> input type="submit" value="Submit"/> form> body> html>

Result

Form example

Example of the HTML tag with the and tags:

html> html> head> title>Title of the document title> head> body> form action="/form/submit" method="GET or POST" > label for="fname">Name label> input type="text" name="Name" id="fname" value="Mary"/>br/>br/> label for="number">Phone label> input type="number" name="Phone" id="number"/>br/>br/> label for="email">Email label> input type="email" placeholder="Enter Email" name="email" required> br/>br/> input type="submit" value="Submit"/> form> body> html>

Example of the HTML tag with the tag:

html> html> head> title>Title of the document title> head> body> h1>Form example h1> form action="/form/submit" method="GET or POST" > textarea rows="3" cols="30" placeholder="Type some text here"> textarea>br/> input type="submit" value="Submit"/> form> body> html>

Attributes

Источник

Оцените статью