<form> Tag in HTML

The <form> tag in HTML is used to create an HTML form for user input. It contains different form elements such as text fields, radio buttons, checkboxes, submit buttons, and more. Forms are essential for collecting data from users and submitting it to the server for processing.

Key Points on <form> Tag:

Syntax of <form> Tag:

Syntax Example

<form action="submit_url" method="POST">
            
        </form>

Example of <form> Tag in HTML:

This example demonstrates how to use the <form> tag to collect a user's name and email address.

Code Example


        <form action="submit_form.php" 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">
            
            <input type="submit" value="Submit">
        </form>
                

Output

The <form> tag is essential for creating interactive forms that collect and submit data from users. The action attribute determines where the form data is sent, and the method attribute controls how the data is sent (e.g., using the GET or POST methods).