HTML Tutorial
<form>
TagThe <form>
tag in HTML is used to create a form that collects user input and submits it to a server for processing. It serves as a container for various input elements, such as text fields, radio buttons, and checkboxes.
<form>
Tag<form>
Tag<!-- Form to collect user information and submit it to the "/process" URL -->
<form action="/process" method="POST">
<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>
<input type="submit" value="Submit">
</form>
Exploring the <form>
Tag
To explore the <form>
tag in action, you can create a simple HTML file with the following code:
<!DOCTYPE html>
<html>
<head>
<title>Example Form</title>
</head>
<body>
<form action="/process" method="GET">
<label for="name">Name:</label>
<input type="text" id="name" name="name">
<label for="email">Email:</label>
<input type="email" id="email" name="email">
<input type="submit" value="Submit">
</form>
</body>
</html>
Save this file as "form.html" and open it in a web browser. You should see a simple form with two input fields and a submit button. When you enter your name and email and click the submit button, the form data will be sent to the "/process" URL using the GET method.