MODULE 02 · CONTENT & DESIGN

Building Contact Forms

Every site eventually needs a way for visitors to reach you. Today you'll build a real contact form, connect it to your inbox, and cover the fields that actually convert.

Day 15 of 30 Beginner ~16 min

Why a Form Beats an Email Address

Posting your raw email address on a page invites spam bots to scrape it within days. A form plugin routes messages through WordPress instead, filtering spam and organizing every submission before it reaches your inbox.

This ties directly back to Day 14 — the form plugin you install today only stays useful once spam protection is active, since a public form without it fills up fast.

Two Common Options

Both of these were mentioned in yesterday's starter stack. They solve the same problem with different levels of complexity.

PLUGIN GOOD FOR
Contact Form 7

Lightweight and free — you write field markup directly, which is great for learning how forms are structured.

WPForms

Drag-and-drop builder with ready-made templates — faster to set up if you want a polished form immediately.

FOR THIS LESSON

We'll build the form conceptually so the steps apply to either plugin — the fields and logic are the same either way.

Structuring Your Form

A contact form only needs a handful of fields. Every extra field you add lowers your completion rate, so keep it lean.

contact-form-fields.txt
// A lean, effective contact form
Name       // single text field, required
Email      // required, validated as a real email format
Subject    // optional dropdown for routing common requests
Message    // multi-line textarea, required

From Blank Page to Working Form

  • Open your form plugin's builder from the dashboard menu it added on install.
  • Start from a "Simple Contact Form" template if one is offered, rather than an empty canvas.
  • Add the four fields from Section 03, marking Name, Email, and Message as required.
  • Set the notification email to the inbox you actually check.
  • Copy the shortcode or block the plugin generates for this form.
  • Paste it onto your Contact page and publish.
  • Client-Side vs Server-Side Checks

    CLIENT-SIDE ONLY The browser blocks an empty "required" field before submit — fast feedback, but easy to bypass by disabling JavaScript.
    SERVER-SIDE TOO WordPress re-checks the same fields after submission, so a bypassed browser check still can't get junk data through.

    What to Check Before You Trust It

    TEST CHECKLIST
    EMPTY SUBMIT Submit with every field blank — required fields should block it with a clear message.
    BAD EMAIL Type something without an @ sign — the email field should reject it before submission.
    REAL SUBMIT Fill it out properly and confirm the notification actually lands in your inbox.

    Breaking Down What You Just Learned

    1

    Forms beat exposed emailsThey route submissions through WordPress instead of scraping bait.

    2

    Keep fields minimalName, email, subject, and message cover almost every use case.

    3

    Build flowTemplate → add fields → set notification email → embed → publish.

    4

    Validate on both endsClient-side checks give instant feedback; server-side checks can't be bypassed.

    5

    Always test end to endAn untested form is a form you can't trust with real leads.

    Try It Yourself

    EXERCISE

    Add a Subject dropdown to your form with three options relevant to your capstone site (for example: "General Inquiry," "Support," "Partnership"). Test that changing the selection doesn't break submission.

    Ship a Working Contact Form

    HANDS-ON EXERCISE

    Getting a real form live on your capstone site

    By the end of today your Contact page should have a working, tested form connected to your inbox.

    1. Build the four-field form described in Section 03.
    2. Set the notification email and confirm spam protection is active.
    3. Embed the form on your Contact page.
    4. Run all three tests from Section 06.
    5. Fix anything that failed and re-test until it passes cleanly.

    Recap

    FORM PLUGINS

    Contact Form 7 for lightweight control, WPForms for a visual builder.

    CORE FIELDS

    Name, email, subject, and message cover most needs.

    VALIDATION

    Client-side for speed, server-side so it can't be bypassed.

    TESTING

    Always test empty, invalid, and valid submissions before trusting a form.

    Key Takeaways

    • A form plugin routes visitor messages through WordPress instead of exposing your raw email address.
    • Keep forms lean — name, email, subject, and message cover nearly every use case.
    • Validate on both the client and server side; only server-side checks can't be bypassed.
    • Always test a form with empty, invalid, and valid submissions before considering it live.
    • A public form is only as safe as the spam protection sitting behind it.
    Course Overview