If your website has a contact box, a quote request, a booking page or a checkout, it has a form. For many small businesses, it’s the single most important thing on the site, because it’s where a visitor turns into an enquiry.
It’s also where things quietly go wrong. A missing label, a field that won’t work properly on a phone, a button that does nothing: each one costs you a customer you never knew you had. This entry in the series walks through the elements that make up a form and what each is for.
The form Element
<form action=”/contact” method=”post”> <!– fields go here –></form>
The form element wraps everything. Two attributes matter most. action says where the data goes, and method says how. GET puts the data in the web address, which suits things like search boxes. POST sends it in the body of the request, which is what you want for contact forms, logins and anything private.
If you’re building the form by hand, something on the server has to receive that data and do something with it. HTML alone can’t send an email. That’s why most WordPress sites use a plugin or a service to handle the other half.
Labels
<label for=”email”>Your email address</label><input type=”email” id=”email” name=”email”>
The label element tells people and assistive technology what a field is for. The for attribute matches the id of the field, so clicking the label also puts the cursor in the box. That makes small touch targets easier to hit on a phone.
Placeholder text is not a replacement. It vanishes as soon as someone starts typing, it’s often too pale to read comfortably, and some screen readers treat it inconsistently. Use a real label every time, and keep the placeholder for a short hint if you need one.
The input Element
Input is the workhorse. One element, many behaviours, controlled by the type attribute. The ones you’ll use most are:
- text for short free-form answers such as a name
- email, tel and url, which bring up a suitable keyboard on phones and give basic checking for free
- number and date, which suit quantities and bookings, although how they look varies between browsers
- password, which hides what’s typed
- checkbox for yes or no choices, and for picking several options
- radio for choosing exactly one option from a group
- file for uploads
- hidden for values the visitor doesn’t need to see
<input type=”text” id=”name” name=”name” autocomplete=”name” required><input type=”tel” id=”phone” name=”phone” autocomplete=”tel”>
The name attribute is what identifies the value when the form is sent. A field without one won’t be submitted, which is a surprisingly common reason for a form that appears to work but delivers nothing.
Textarea, Select and Option
<label for=”message”>Your message</label><textarea id=”message” name=”message” rows=”5″></textarea><label for=”service”>What do you need?</label><select id=”service” name=”service”> <option value=””>Please choose</option> <option value=”website”>A new website</option> <option value=”seo”>Help with SEO</option></select>
Textarea is for longer text, like a message. Select gives a dropdown list, with each choice written as an option. Dropdowns work for a handful of choices, but for two or three options, radio buttons are usually quicker because everything is visible at once.
Fieldset and Legend
<fieldset> <legend>How would you like us to reply?</legend> <label><input type=”radio” name=”reply” value=”email”> Email</label> <label><input type=”radio” name=”reply” value=”phone”> Phone</label></fieldset>
Fieldset groups related fields, and legend gives the group a name. It matters most for radio buttons and checkboxes, where each option needs the question as context. Screen readers announce the legend with each option, so people know what they’re answering.
The button Element
<button type=”submit”>Send message</button>
A button inside a form submits it by default, so it’s good practice to state the type clearly. Use submit for sending, button for something that shouldn’t send the form, and reset sparingly, since people rarely want to wipe what they’ve typed.
Make the wording specific. “Send message” or “Request a quote” tells people what happens next. A bare “Submit” doesn’t.
Helping People Fill It In
- required marks a field as mandatory, so the browser stops an empty submission
- autocomplete lets browsers fill in familiar details such as name, email and address, which saves effort on a phone
- pattern, min and max set simple rules for what’s accepted
- aria-describedby can link a field to a hint or an error message so assistive technology reads it out
Be careful with validation. Browser checks are a courtesy to the visitor, not a security measure, because anyone can bypass them. Whatever receives the data must check it again on the server.
Accessibility Basics
- Every field has a visible label
- The form can be used with a keyboard alone, and the focus outline is clear
- Error messages say what’s wrong and how to fix it, in text and not just colour
- Required fields are marked in a way that doesn’t rely on colour alone
- Touch targets are large enough to tap comfortably
These aren’t extras. They make a form usable for the widest range of visitors, and they tend to reduce abandoned forms for everyone.
Spam, Security and Privacy
Any public form will attract spam. A hidden honeypot field, a simple challenge or a reputable spam filter can all help, and I’d choose the least annoying option that works for you. Heavy-handed puzzles frustrate genuine visitors.
Use HTTPS so that what people type is encrypted on the way. If you collect personal details, say what you’ll do with them and link to your privacy policy. UK data protection rules apply to enquiry forms like any other, so if you’re unsure of your obligations, it’s worth taking proper advice.
File upload fields carry extra risk, so only add them when you truly need them, and make sure whoever handles the uploads checks file types and sizes.
Forms in WordPress
Most WordPress sites don’t hand-code forms. They use a form plugin, which builds the HTML for you and deals with sending emails and storing entries. That’s sensible, but it doesn’t remove the need to check the basics: labels, mobile layout, spam protection and where the messages actually end up.
The most useful habit is simple. Send a test enquiry from your phone after every change, and confirm that it arrives in the right inbox and not in spam.
A Quick Form Checklist
☐ Every field has a visible label tied to it with a for and id
☐ Each field has a name so its value is sent
☐ Input types match the data, such as email and tel
☐ Required fields are marked clearly, and autocomplete is set where it helps
☐ Radio buttons and checkboxes are grouped with fieldset and legend
☐ The button text says what will happen
☐ Data is checked on the server as well as in the browser
☐ Spam protection is in place without annoying real visitors
☐ The page uses HTTPS and links to a privacy policy
☐ I’ve sent a test enquiry from a phone, and it arrived
Frequently Asked Questions
What is the difference between GET and POST?
GET puts the form data in the web address and suits searches and filters. POST sends the data in the body of the request, so it’s better for contact forms and anything private.
Why isn’t my form sending the data?
Common causes include fields with no name attribute, a missing or incorrect action, or no server-side code set up to receive the data. Browser developer tools will usually show what’s being sent.
Do I need a plugin for a contact form in WordPress?
Usually, yes. HTML can display a form, but something has to receive and process it. A reputable form plugin handles that, plus spam protection and notifications.
Is placeholder text enough instead of a label?
No. Placeholders disappear when someone types and can be hard to read or inconsistent with assistive technology. Use a proper label and keep any placeholder for a short example.
How do I stop spam from my contact form?
Combine sensible measures such as a honeypot field, a spam-filtering service, and server-side checks. Choose the least intrusive option that works, because heavy puzzles put real visitors off.
Is Your Contact Form Costing You Enquiries?
If you’d like a second pair of eyes on how your forms work, get in touch, and we can have a relaxed chat, no obligation and no sales pitch.