Form Basics

HTML forms are used to collect user input on a website. They allow users to enter information like name, email, password, and other details.

What is a Form

A form in HTML is created using the <form> tag. It is used to send data to a server for processing.

Basic Structure of a Form

The form contains different input elements like text boxes, buttons, and dropdowns.

Example of a Basic Form

<form> <input type=”text” placeholder=”Enter Name”> <input type=”submit” value=”Submit”> </form>

Form Tag

The <form> tag defines the start and end of a form. All input fields are placed inside it.

Input Tag

The <input> tag is used to create different types of input fields such as text, email, password, and more.

Submit Button

The submit button is used to send form data to the server.

Example of Submit Button

<input type=”submit” value=”Submit”>

Action Attribute

The action attribute defines where the form data will be sent.

Method Attribute

The method attribute defines how data will be sent, usually using GET or POST.

Summary

HTML forms are used to collect user data. They are created using the <form> tag and include input fields and a submit button for sending information.

Home » HTML Intermediate > Forms & User Input > Form Basics