Join our Newsletter — 33% off our NHI Course
Home› Guides› Website Forms for Beginners: How to Keep Contact…
Guide Security Policies & Awareness

Website Forms for Beginners: How to Keep Contact and Login Forms Safe

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 28 November 2026 12 min read
On this page

A website form is a box on a web page where visitors type details and send them to you.

This guide is for small business owners, website editors and students who want to know how forms get misused. You do not need to write code to be affected: if your site has a contact, booking or login form, strangers and their tools can use it too.

In short

  • Anyone can send anything through a form, including automated tools called bots.
  • Common problems are spam, fake sign-ups, password guessing and tricky text that tries to confuse the website.
  • The website must check every message on its own computer, not only in the visitor's browser.
  • Keep form add-ons updated, add a bot check, limit repeated sends and ask only for the details you need.

What you will learn

  • Explain why a form is an open door into your website.
  • Spot the signs that a form is being misused.
  • Check the basic protections on your own forms.
  • Ask your web supplier the right questions about form safety.
Automated visitor (bot)
a program that visits websites and fills in forms without a person.
Checking what is typed (input validation)
the website's check that each answer looks the way it should.
Website computer (server)
the computer that runs your site and receives what forms send.

What is website forms security?

Think of a letterbox in your front door. It is there so friends can post you notes. But anyone can push anything through it, and you cannot choose who walks up the path.

A website form is the same. A contact form, a booking form, a newsletter sign-up and a login page are all forms. Each one lets a stranger send text straight to your website's server (the computer that runs the site).

Form security means making sure that what comes through the letterbox is checked before it is used. It also means making it hard for bots (programs that act like visitors) to flood you with junk.

Where the comparison stops working: a letterbox gets a few items a day. A form can be filled in thousands of times an hour by a bot, from anywhere in the world.

Why does it matter?

A misused form can bury your inbox in spam, fill your mailing list with fake names or help someone guess a password. In worse cases, badly built forms let a stranger read or change data the site holds.

If you run a small business website

What could happen: your contact form sends hundreds of junk messages a day, and a real customer enquiry gets lost.

Check this: ask your web supplier which bot check and limits your forms use.

Next: Website Security for Beginners

If you edit or manage the site

What could happen: an old form add-on has a known weak spot that lets strangers in.

Check this: keep form add-ons updated and delete ones you do not use.

Next: WordPress Security for Beginners

If you are learning to build websites

What could happen: you trust the browser's checks, and a bot skips them by sending data straight to your server.

Check this: check every field again on the server before you use it.

Next: Input Validation for Beginners

What does it look like?

Here is a made-up list of messages sent through a florist's contact form in one night.

Example only. All values are made up.

Contact form inbox, Wren Florist (example.com)
02:14  Name: aaaa   Email: [email protected]   "Cheap pills, click here"   (1)
02:14  Name: aaab   Email: [email protected]   "Cheap pills, click here"
02:15  ... 412 more messages in 6 minutes                                   (2)
02:31  Name: <FAKE-CODE-0000>   Message: [strange symbols]                  (3)
03:02  Login page: 900 failed sign-ins for user "admin"                     (4)
07:45  Name: Jo Example   "Can I order flowers for Friday?"                 (5)
  1. Spam sent by a bot. The names and words are almost the same each time.
  2. Hundreds of sends in minutes. A person cannot type that fast, so this is automated.
  3. In a real message, this box might hold code instead of a name. It tests whether the site gets confused.
  4. Someone is guessing passwords on the login form.
  5. A genuine customer, buried under the junk.

Why this is risky: the junk wastes time. It also hides real customers. The strange text shows someone is testing the site.

The safer way: a bot check filters out many automated sends. A limit slows repeated sends from one place. The server checks every field and handles it safely.

How does it work?

Here is what happens when someone presses Send, and where the checks belong.

  1. The visitor fills in the form. The browser may check simple things, like an email box holding an @ sign.
  2. The form is sent. The details travel to your server. A bot can skip the browser and send data straight to the server, so browser checks are easy to get round.[1]
  3. The server checks it again. It looks at each field and rejects anything that is not the right shape or length. This is called input validation.[1]
  4. The server handles it safely. If the details go into a database, the site keeps its commands separate from the visitor's text. This guards against SQL injection, where typed text is treated as a database command.[2]
  5. The details are shown safely. When the site shows a message back on a page, it turns any code into plain text. This guards against cross-site scripting, where typed text runs as code in someone's browser.[3]
Diagram titled From Send to safe: where form checks happen. Four boxes left to right. 1 Visitor or bot fills in the form. 2 Browser check, quick help for people, a bot can skip it. 3 Server check: right shape and length, bot check passed, not too many sends. 4 Safe use: database keeps commands separate, page shows text as text. A green bar underneath says the server checks are the ones that count.
Figure 1. Browser checks help people. The server checks are the ones that protect the site.

Two more layers deal with bots. A bot check, often called a CAPTCHA, tries to tell people from programs. Some newer ones work quietly in the background and give each visit a score. The website must still confirm that score on its own server.[4] Other tools aim to avoid showing a puzzle at all, but may show a tick box when a visit looks risky.[5]

The second layer is rate limiting, which means capping how many times one place can send a form in a set time. We suggest it for contact and login forms, because it slows spam floods and password guessing.

Login and account forms need one more guard. A trick called cross-site request forgery makes your browser send a form you did not mean to send, while you are logged in. Most modern website tools have a built-in guard for this, and it should be switched on.[6]

Before and after diagram titled Same form, two set-ups. Left panel Risky: browser check only, no bot check, no limit on sends, form asks for date of birth and home address it does not need, old form add-on. Right panel Safer: server checks every field, bot check confirmed on the server, limit on repeated sends, asks only name, email and message, add-on kept up to date.
Figure 2. The same contact form, set up the risky way and the safer way.

Finally, ask only for what you need. The UK data protection regulator says you should not collect personal data just in case it might be useful later.[7] Fewer fields means less to protect if something goes wrong.

A worked example

Yara Delmar runs Wren Florist, a fictional flower shop with a small website. Her friend Hal Bergmann built the site for her two years ago.

One Monday Yara opens her inbox and finds over 600 messages from the contact form. Almost all of them are adverts. Somewhere in the pile is an order for a wedding, but she does not see it until Wednesday.

She thinks of her shop's letterbox. If someone pushed 600 leaflets through it overnight, she would fit a better letterbox, not just sweep the floor.

Yara calls Hal. He looks at the form and finds three gaps. The form has no bot check. There is no limit on how often it can be sent. And the form add-on is a year out of date.

Hal updates the add-on first, because updates often fix known weak spots. Then he turns on a quiet bot check that scores each visit, and confirms it on the server. He adds a limit, so one place can send only a few messages in ten minutes.

He also notices the form asks for a home address and a date of birth. Yara only needs a name, an email and a message. Hal removes the extra boxes.

The next week Yara gets around ten junk messages a day, not hundreds. She sets a weekly reminder to check that the form add-on is up to date.

Myths and mistakes

What people thinkWhat is true
My site is too small for anyone to bother with its forms.Bots fill in forms on huge numbers of sites automatically. Size does not decide it.
The browser checks the form, so the site is safe.Browser checks are easy to skip. The server must check everything again.[1]
Blocking odd symbols like quote marks fixes injection.That blocks real names like O'Brien and still leaves gaps. Keeping commands separate from text is the main fix.[1]
A CAPTCHA stops all spam.It cuts a lot of automated spam, but some gets through. Use it with limits and server checks.
Collecting extra details is harmless.Every extra field is more personal data to protect and justify.[7]

What can I do this week?

  • List every form on your site, including login, sign-up, booking and search boxes.
  • Check that each form add-on is up to date, and delete forms you no longer use.
  • Ask your web supplier whether forms are checked on the server and have a bot check.
  • Remove any form field you do not really need.
  • Turn on a limit for repeated sends on contact and login forms, if your tools allow it.

Checklist

  • Every form is listed, with a named person who looks after it.
  • The server checks every field for the right shape and length.
  • Database queries keep commands separate from what visitors type.
  • Messages shown back on a page are shown as plain text.
  • Contact, sign-up and login forms have a bot check confirmed on the server.
  • Repeated sends from one place are limited.
  • Built-in protection against forged form sends is switched on.
  • Form add-ons are kept up to date, and unused ones are removed.
  • Forms ask only for the details you need.

Common questions

Why am I getting so much spam through my contact form?

Usually because bots have found it. Bots scan the web for forms and fill them in automatically, often to post adverts or links. A bot check, a limit on repeated sends and a hidden trap field that only bots fill in can cut the volume a lot. See Comment and Review Spam for Beginners.

Is a contact form safer than showing my email address?

It can be, if it is set up well. A form hides your address from tools that collect emails from web pages. But a badly set up form can be flooded or misused, so it still needs a bot check, limits and updates. Either way, expect some spam.

What is SQL injection in simple terms?

It is when text typed into a form is treated as a command by the site's database. That can let a stranger read or change stored data. The main fix is for the site to keep commands and typed text separate. See SQL Injection for Beginners.

Do I need a CAPTCHA on every form?

Not always. Put bot checks where bots cause harm: contact, sign-up, login and password reset forms. A search box may only need a limit on sends. Too many puzzles annoy real visitors, so quiet, score-based checks are often a better fit. See CAPTCHA for Beginners.

Can someone upload a harmful file through a form?

Yes, if the form accepts files and does not check them. Upload boxes need extra care, such as limits on file type and size and storing files away from the site's own code. See File Upload Security for Beginners.

Where next?

Ready for the detail? Read the practitioner guide: Small Business Website Security Guide. It goes further into hosting choices, plugin control, user roles and a phased plan for the whole site.

Also useful:

Related NHI Mgmt Group resources: Bots and Bot Traffic for Beginners · Data Minimisation for Beginners · WordPress Security for Beginners

Key terms

Input validation
Checking that what a visitor types is the right shape and length before the site uses it.
Server-side validation
Checks done on the website's own computer, which visitors and bots cannot skip.
SQL injection
An attack where typed text is treated as a command by the site's database.
Cross-site scripting
An attack where typed text runs as code in another visitor's browser.
Cross-site request forgery
A trick that makes a logged-in browser send a form the person did not mean to send.
CAPTCHA
A check that tries to tell people from automated programs.
Rate limiting
Capping how many times one source can do something in a set time.
Data minimisation
Collecting only the personal details you need for your purpose.

Sources and further reading

  1. Input Validation Cheat Sheet. OWASP Cheat Sheet Series, OWASP Foundation. https://cheatsheetseries.owasp.org/cheatsheets/Input_Validation_Cheat_Sheet.html, accessed 28 Nov 2026.
  2. SQL Injection Prevention Cheat Sheet. OWASP Cheat Sheet Series, OWASP Foundation. https://cheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html, accessed 28 Nov 2026.
  3. Cross Site Scripting Prevention Cheat Sheet. OWASP Cheat Sheet Series, OWASP Foundation. https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html, accessed 28 Nov 2026.
  4. reCAPTCHA v3. Google for Developers, Google. https://developers.google.com/recaptcha/docs/v3, accessed 28 Nov 2026. (Google marks this page as deprecated and points to its newer fraud defence documentation.)
  5. Turnstile overview. Cloudflare Docs, Cloudflare. https://developers.cloudflare.com/turnstile/, accessed 28 Nov 2026.
  6. Cross-Site Request Forgery Prevention Cheat Sheet. OWASP Cheat Sheet Series, OWASP Foundation. https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html, accessed 28 Nov 2026.
  7. Principle (c): Data minimisation. Information Commissioner's Office (ICO). https://ico.org.uk/for-organisations/uk-gdpr-guidance-and-resources/data-protection-principles/a-guide-to-the-data-protection-principles/data-minimisation/, accessed 28 Nov 2026.

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.