HTML Form
HTML form is used to get information from user. This information is taken depending on various things, such as - contact form, login form, blog post form etc. User information is stored on the server because this information is important.
An HTML form primarily depends on three sections to function effectively: front-end, back-end, and database. No form can work without these three divisions. Here, only the work of the front-end section has been explained.
HTML form contains some input tags inside. Data is collected from the user with this input tag. Some attributes are used in this input tag. For example: type, name, placeholder, etc. Each attribute works differently.
type Attribute: This attribute is used to determine the type of the input box. This means determining how an input box will work. For example: the text attribute is used to write text, similarly, the password attribute is used to write a password.
name Attribute: The name attribute is used to send user information to the server.
placeholder Attribute: If this attribute is used, the user understand what to write in the input box.
The label tag is used with the input tag. Because, so that the user can understand what kind of information should be given in this input box. When the user clicks on the label tag, it selects the input box associated with the label tag.
Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h3>HTML Form</h3>
<form>
<label for="firstName">First name</label> <br>
<input type="text" name="" id="firstName" placeholder="Enter your first name"> <br>
<label for="lastName">Last name</label> <br>
<input type="text" name="" id="lastName" placeholder="Enter your last name"> <br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>