What is Form Tag in HTML?
- Form is mainly used to take the data from the user to serve on the server.
- The form is a collection of input tags in an HTML document.
- Forms in HTML are created using the <form> tag.
Form Tag Attributes
- action: This attribute specifies what action will be taken after submitting the form.
- target: This specifies on which browser tab the response will be displayed after form submission.
- method: This attribute is used to define the HTTP method used to submit the form.
Code Described in the video
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Forms in HTML </title>
</head>
<body>
<form action="index.php" method="get">
First Name: <input type="text"> <br><br>
Last Name: <input type="text"> <br><br>
Gender: <input type="radio" name="gender"> Male <br><br>
<input type="radio" name="gender"> Female <br><br>
<input type="radio" name="gender"> other <br><br>
Email: <input type="email"> <br><br>
Phone: <input type="number">
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>
</body>
</html>