An HTML or a Web form helps collect user input. HTML forms can have different fields, such as text areas,
text boxes, radio buttons, checkboxes, drop-down lists, file uploads, etc. To create an HTML form, we will
use the HTML <form> element. It starts with the <form> tag and ends with the </form>
tag. We can add the input elements
within the <form> tags for taking user input.
Example:
<!DOCTYPE html>
<html>
<head>
<title>Sample Form</title>
</head>
<body>
<h1>Contact Us</h1>
<form action="/submit_form" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name">
<label for="email">Email:</label>
<input type="email" id="email" name="email">
<label for="message">Message:</label>
<textarea id="message" name="message" rows="4" cols="50"></textarea>
<input type="submit" value="Submit">
</form>
</body>
</html>
Output:
Sample Form
Contact Us