Learn HTML - Form element

Опубликовано: 25 Февраль 2023
на канале: Konstantyn's coding
124
19

More info on form HTML element: https://developer.mozilla.org/en-US/d...

In this video, we'll take a look at form element in HTML which is used to collect data from inputs which user has entered and then send it to the server.

To create a form on a webpage, you use the `form` tag in HTML. Inside the `form` tag, you can add various types of input fields, such as text boxes, checkboxes, radio buttons, dropdown lists, and more.

When a user fills out a form and submits it, the data is sent to the server for processing. The server can then use this data to do things like send an email, store the information in a database, or display a confirmation message.

To specify where the data should be sent, you use the `action` and `method` attribute on the `form` tag. `action` attribute specifies the URL of the server-side script or program that will handle the data. And `method` - the type of action.

In this example, the `action` attribute is set to `"submit.php"`, which means that when the form is submitted, the browser will send a POST request to the `submit.php` script with the form data as parameters. The `method` attribute is set to `post`, which means that the form data will be sent in the request body rather than in the URL.

To create a button for submitting user input to server we can use both input type submit, or a button with the same type.