How To Submit A Form In Html

Table of contents:

How To Submit A Form In Html
How To Submit A Form In Html

Video: How To Submit A Form In Html

Video: How To Submit A Form In Html
Video: Learn HTML Forms In 25 Minutes 2024, December
Anonim

In order to organize the interaction of a web resource with visitors, it is necessary to provide for the possibility of entering information on the pages of the site and then sending it to the server. The HTML page description language provides a specific set of tags.

How to submit a form in html
How to submit a form in html

Instructions

Step 1

HTML tags that tell the web browser where on the page to display the form are placed in the code between the opening and closing tags and. The opening tag contains the required information in the form of attributes that tell where exactly the necessary information should be sent from the form and in what way it should be done. If a virtual page contains more than one form, then each separately must have its own name.

Step 2

The opening tag may look like this: The "name" attribute here is the name of the form, and the "method" attribute is the method for sending data (the GET or POST methods are possible). The "action" attribute specifies the URL script on the server to which the data should be sent from the form. If you do not specify the address, then the data will be transferred to the URL of the same page. Such interactive pages, as a rule, are formed by special universal scripts that provide both receiving and processing information from the same page.

Step 3

Place elements that are more suitable for user input of the required data type after the opening tag of the form. Similar elements can be: Field with text for input: Here, as in the rest of the "input" tags, the attribute "type" sets the type of the element, "name" is the name of the variable that will be sent along with the data entered in this field, and " value "- the default value, which will subsequently be filled in the text input field.

Step 4

Keep in mind that all elements of the group must have the same name and different values. Only the value that the visitor marks or the one selected by the checked attribute, that is, by default, will be sent to the server.

Recommended: