Google Advertisement

Beginner's Guide to Building an HTML Form with Input Fields

Google Advertisement
πŸ”₯ Read with Full Features on Our Website

Learn how to create a simple HTML form with name, email, and password input fields. This beginner-friendly tutorial includes easy steps and clear code examples.

Published on 02 May 2025
By Vandu

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

Creating a form in HTML is one of the most essential skills for any web developer. Whether you're building a contact form, login form, or registration page, HTML forms are used to collect input from users.

πŸ”₯ Read with Full Features on Our Website

In this guide, you'll learn how to create a basic HTML form with three common fields:

Let’s get started step-by-step.


πŸ”Ή Step 1: Create the Basic HTML Structure

Before creating the form, we need a basic HTML page structure. This includes:

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

</body>
</html>

Explanation:


πŸ”Ή Step 2: Add the Form Tag

Now let’s insert a form element inside the <body>:

<form action="#" method="post">
  
</form>

Explanation:


πŸ”Ή Step 3: Add Input Fields – Name, Email, Password

Now let’s add the three input fields and a submit button inside the form:

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

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

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

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

πŸ” Explanation of Each Part

βœ… <label for="name">Name:</label>

βœ… <input type="text" id="name" name="name">

βœ… <input type="email" id="email" name="email">

βœ… <input type="password" id="password" name="password">

βœ… <input type="submit" value="Submit">


πŸ§ͺ Final Code – Copy and Paste

Here’s the full code with everything combined:

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

  <h2>Registration Form</h2>

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

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

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

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

</body>
</html>

πŸŽ‰ Output Preview

When this code runs in a browser, you’ll see:

Try entering values and hitting Submit — although the data won't go anywhere right now, the browser will check if all fields are filled.


πŸ› οΈ Tips for Beginners


πŸ“Œ Conclusion

You’ve just learned how to create a basic HTML form with name, email, and password fields! This is the foundation of most login, registration, and contact pages. Once you're comfortable with forms, you can explore things like validation, styling with CSS, or processing with JavaScript.

❀️ Like πŸ’¬ Comment πŸ”— Share
Google Advertisement
πŸ‘‰ View Full Version on Main Website β†—
Google Advertisement
πŸ‘‰ Read Full Article on Website