Loading...
Loading...
00:00:00

<form> Tags and its child tags 

The <form> element in HTML5 is used to create forms that allow users to input data and submit it to a server for processing. The form data can be sent to the server using methods such as GET or POST.

Here is an example of a basic HTML5 form with several common form elements:

<form action="https://example.com/submit-form" method="post">
  <fieldset>
    <legend>Personal Information:</legend>
    <label for="name">Name:</label>
    <input type="text" id="name" name="name" required>
    
    <label for="email">Email:</label>
    <input type="email" id="email" name="email" required>
    
    <label for="password">Password:</label>
    <input type="password" id="password" name="password" required>
  </fieldset>
  
  <fieldset>
    <legend>Shipping Information:</legend>
    <label for="address">Address:</label>
    <input type="text" id="address" name="address" required>
    
    <label for="city">City:</label>
    <input type="text" id="city" name="city" required>
    
    <label for="state">State:</label>
    <select id="state" name="state" required>
      <option value="">Select a State</option>
      <option value="AL">Alabama</option>
      <option value="AK">Alaska</option>
      <option value="AZ">Arizona</option>
      <!-- Add other states -->
    </select>
  </fieldset>
  
  <input type="submit" value="Submit">
</form>

In this example, the form is defined using the <form> element, with an action attribute specifying the URL to which the form data will be submitted, and a method attribute specifying the HTTP method (POST) used to submit the data.

The form is divided into two fieldsets, each with its own legend, which help to organize the form and provide a label for each group of form controls.

Within each fieldset, there are several form controls, including text input fields, an email input field, a password input field, a text input field, a select element, and a submit button. Each form control is associated with a label using the for and id attributes, and has a name attribute that will be used to identify the data when it is sent to the server. Some of the form controls also have a required attribute, which specifies that the form control must be filled out before the form can be submitted.