Authoritative login form html. Creating a Form in HTML


HTML tags that define HTML forms on the site

We create websites and individual pages on the Internet to communicate with visitors.

HTML forms are used to register visitors on the site, for interactive surveys and voting, allow you to send messages, make purchases, and so on. HTML The form is created for one purpose: collecting and subsequently transmitting information for processing by a software script or via email.

Example HTML form | Enter the site

Tags, attributes and values

  • - determine the shape.
  • name="" - defines the name of the form.
  • method="" - defines the method of sending data from the form. Values: "get" (default) and "post" . The "post" method is often used, as it allows large amounts of data to be transferred.
  • action="" - defines the url at which the data is sent for processing. In our case - enter_data.php ..
  • - define such form elements as buttons, switches, text fields for data entry.
  • type="text" - defines a text field for data entry.
  • type="password" - defines a field for entering a password, with the text displayed in the form of asterisks or circles.
  • type="checkbox" - defines a radio button.
  • type="hidden" - defines a hidden form element - used to transfer additional information to the server.
  • size="25" - length of the text field in characters.
  • maxlength="30" - the maximum allowed number of entered characters.
  • value="" - defines the value that will be sent for processing if it applies to radio buttons or switches. The value of this attribute as part of a text field or button will be shown as, for example, Vasya or Login in the example above.

Example HTML form | Comments on the site

Example HTML form




Name



Mail








Tags, attributes and values

  • action="http://site/comments.php" - defines the url to which data from the form will be sent.
  • id="" - defines the name and identifier of the form element.
  • name="" - defines the name of the form element.
  • - define a text field as part of the form.
  • cols="" - determines the number of columns of the form text field.
  • rows="" - defines the number of rows of the form text field.

If between place text, it will be shown inside the field as an example that can be easily removed.

Example HTML form | Drop-down list

HTML forms




Tags, attributes and values

  • - define a list with positions to select.
  • size="" - determines the number of visible list positions. If the value is 1 , we are dealing with a dropdown list.
  • - determine the positions (items) of the list.
  • value="" - contains the value that will be sent by the form to the specified url for processing.
  • selected="selected" - highlights a list item as an example.

Example HTML form | List with scroll bar

By increasing the value of the size="" attribute, we get a list with a scroll bar:

First position Second position Third position Fourth position

HTML forms




For this option, use the multiple="multiple" flag, which makes it possible to select multiple positions. Its absence allows you to select only one item.

  • type="submit" - defines a button.
  • type="reset" - defines a reset button.
  • value="" - defines the label on the button.
  • See additionally:

    HTML forms are complex interface elements. They include different functional elements: input fields And