HTML 003: Forms

Neha
GigaGuardian
Published in
1 min readJan 2, 2023
ImageSource

Here are some important terms related to HTML forms that we should know:-

  1. Form elements: These are the different types of fields that can be added to a form, such as text boxes, radio buttons, and dropdown menus.
  2. Action: The action attribute specifies where to send the form data when the form is submitted.
<form action="/submit-form">
<!-- form elements go here -->
</form>

3. Method: The method attribute specifies the HTTP method to use when submitting the form data. The most commonly used methods are “get” and “post”.

<form action="/submit-form" method="post">
<!-- form elements go here -->
</form>

4. Input: The input element is used to create various types of input fields, such as text boxes, radio buttons, and checkboxes.

<form>
<label for="name">Name:</label><br>
<input type="text" id="name" name="name"><br>
<input type="radio" id="male" name="gender" value="male">
<label for="male">Male</label><br>
<input type="radio" id="female" name="gender" value="female">
<label for="female">Female</label><br>
</form>

5. Label: The label element is used to label the different form elements.

<form>
<label for="name">Name:</label><br>
<input type="text" id="name" name="name"><br>
</form>

6. Select: The select element is used to create a dropdown menu.

<form>
<label for="cars">Choose a car:</label><br>
<select id="cars" name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
</form>

I hope you enjoyed this introduction to HTML Forms!

Follow me: LinkedIn, Twitter

--

--