Google Advertisement

How to Build a Basic HTML Form with Input Fields Step-by-Step

Google Advertisement
🔥 Read with Full Features on Our Website

Learn how to create a simple HTML form with name, email, and password fields. This beginner-friendly guide explains everything step by step with clear code examples.

Published on 09 May 2025
By ttimesnow

📝 Create a Simple HTML Form with Name, Email, and Password Fields

Forms are an essential part of web development. Whether you're collecting user information, signing up users, or handling contact details, HTML forms are the building blocks.

🔥 Read with Full Features on Our Website

In this guide, we’ll create a simple HTML form with three fields:

Let’s break it down step-by-step in easy words so that even a beginner can understand.


🔧 Step 1: Basic Structure of an HTML Page

Google Advertisement

Before we create a form, we need to set up a basic HTML page.

<!DOCTYPE html>
<html>
<head>
    <title>Simple HTML Form</title>
</head>
<body>

    <!-- Our form will go here -->

</body>
</html>

📝 Explanation:


🧾 Step 2: Create the Form Tag

Now let’s add the form inside the <body>.

<form action="#" method="post">
    <!-- Form elements will go here -->
</form>

📝 Explanation:


✏️ Step 3: Add the Name Field

<label for="name">Name:</label>
<input type="text" id="name" name="name" required><br><br>
 

📝 Explanation:

  • <label>: Defines a label for the input field. The for="name" connects it with the input having id="name".

  • <input type="text">: Creates a text input for the name.

  • required: This makes the field mandatory (form won’t submit if it’s empty).


📧 Step 4: Add the Email Field

<label for="email">Email:</label>
<input type="email" id="email" name="email" required><br><br>

📝 Explanation:

  • type="email": Special input type that ensures the entered value is a valid email address.

  • required: Makes this field mandatory.


🔐 Step 5: Add the Password Field

<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br><br>
 

📝 Explanation:

  • Google Advertisement

    type="password": Masks the characters typed, for privacy.

  • Useful for login or signup forms.

  • required: Field must be filled to submit.


▶️ Step 6: Add a Submit Button

<input type="submit" value="Submit">
 

📝 Explanation:

  • type="submit": Creates a button that sends the form data.

  • value="Submit": The text shown on the button.


Final Complete Code

Here’s the full HTML form code:

<!DOCTYPE html>
<html>
<head>
    <title>Simple HTML Form</title>
</head>
<body>

    <h2>Registration Form</h2>
    
    <form action="#" method="post">
        <label for="name">Name:</label>
        <input type="text" id="name" name="name" required><br><br>

        <label for="email">Email:</label>
        <input type="email" id="email" name="email" required><br><br>

        <label for="password">Password:</label>
        <input type="password" id="password" name="password" required><br><br>

        <input type="submit" value="Submit">
    </form>

</body>
</html>

 


💡 Extra Tips for Beginners

  • Always use labels for better accessibility.

  • Use type="email" and type="password" for proper validation and security.

  • Use required to ensure fields are not left empty.

❤️ Like 💬 Comment 🔗 Share
Google Advertisement
👉 View Full Version on Main Website ↗
Google Advertisement
👉 Read Full Article on Website