How to Create Forms in HTML for Beginners
A beginner's guide to HTML forms: how the <form> tag sends data for logins, sign-ups and contact messages, starting from the basics.
- Reading time
- 1 min read
- Comments
- Discussion

Basic Form Structure
<form action="/submit" method="POST">
<!-- form fields go here -->
<button type="submit">Submit</button>
</form>- action → where the data will be sent
- method → how the data is sent (GET or POST)
GET vs POST
- GET → sends data through the URL (good for search forms)
- POST → sends data in the background (better for login, contact, or sensitive info)
Simple Contact Form Example
<form action="/contact" 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" />
<label for="message">Message:</label>
<textarea id="message" name="message"></textarea>
<button type="submit">Send Message</button>
</form>Quick Tips
- Always use a
<label>so users know what each field is for. - Give every input a name attribute, this is what gets sent with the data.
- Use POST for forms that handle private information.
- The action can point to a backend file or API endpoint.

Written by
Razak
Writes about the web, slowly, and builds small tools on the side.
Keep reading
Read next
1 minHTML
Best Practices for Writing Clean and Valid HTML
A collection of HTML best practices including proper indentation, naming, W3C validation, and common beginner mistakes you should avoid.
Read article
2 minHTML
Getting to Know HTML Iframe: How to Embed YouTube and Google Maps
How to use the HTML <iframe> tag to embed content from other sites, like a YouTube video or a Google Map, inside your own page.
Read article
1 minHTML
HTML Form Validation Without JavaScript
HTML5 has built-in form validation: required fields, length and number limits, and format patterns, all without a single line of JavaScript.
Read article
Discussion
Comments
Loading comments…