HTML Forms

<form> is an Html element that can collect data from the user, inputs such as input texts, numbers, values, email, password, and control fields such as radio buttons, checkboxes, submit buttons, etc. Or in other words, a form is a container, containing input elements such as texts, numbers, values, email, password, etc.

For example, if a user wants to order a pizza, for that the user has to select the pizza, its toppings, add-ons, the address to be delivered to, phone number, etc. All these data can be input by a form.

Form Elements: 

<input> – It is used to get input data from the form in various types such as text, password, email, etc by changing its type.

<label> – It defines label for <form> elements.

<button> – It defines a clickable button to control other elements or execute a functionality.

<textarea> – It is used to get input long text content.

<select> – It is used to create a drop-down list.

<option> – It is used to define options in a drop-down list.

<legend> – It defines a caption for fieldset elements.

An example of form, 

<!DOCTYPE html>
<html>
    <head>
    <title>Page Title</title>
    </head>
    <body>
        <h2>A form example.</h2>
        <form>
            <-- label elements for defining the input elements. Input elements are for taking data from the user. -->
            <label>Username : <input type="text" /></label>
            <label>Password : <input type="password" /></label>
            <-- button to submit the form. -->
            <button type="submit">Submit</button>
        </form>
    </body>
</html>