Building Blocks › Contact Forms

Contact form patterns

Three proven contact form patterns — from a simple enquiry form to a multi-step quote builder. Each includes a PHP handler, SMTP delivery, MySQL log, and spam protection. Deploy any of them in a single conversation with Claude.

Contact form patterns for every use case

Pick the pattern that fits your site. Each comes with the full prompt you paste into Claude — adapt it to your brand and deploy.

1. Simple Contact Form

The standard contact form for any website. Name, email, and message with PHP form handling, SMTP delivery, honeypot spam protection, and MySQL submission logging. Minimal but complete.

PHP MySQL SMTP Honeypot
  • Name, email, and message fields with HTML5 required validation
  • PHP PDO handler — validates, sanitises, and inserts to MySQL
  • SMTP email delivery with formatted notification to site owner
  • Honeypot hidden field + server-side rate limiting (5 per IP per hour)
  • contact_submissions MySQL table with timestamp, IP, and message body
  • Success/error messaging via fetch API — no page reload
Prompt to use with Claude

Add a simple contact form to my site. Fields: full name, email address, and message. Submit via PHP, email the submission to [your@email.com] via SMTP (host: [smtp.host], port: 587, user: [user], pass: [pass]), store it in a MySQL table called contact_submissions, include a honeypot field, and show a success message on submission without reloading the page.

2. Multi-field Enquiry Form

A detailed form for B2B and service businesses. Captures qualified lead information including service type, budget range, and timeline — useful for routing and prioritising inbound enquiries. Auto-responder confirms receipt to the user.

PHP MySQL SMTP GDPR Auto-responder
  • Full name, company (optional), email, phone, service type (dropdown), budget range, timeline, and message
  • GDPR consent checkbox (required) with configurable privacy policy link
  • Client-side + server-side validation — all fields checked before insert
  • Formatted HTML notification email to site owner via SMTP
  • enquiries MySQL table with status column (new / contacted / closed)
  • Auto-responder confirmation email sent back to the enquirer
Prompt to use with Claude

Build an enquiry form for [my type of business]. Fields: full name, company name (optional), email, phone, service type (dropdown: [list your services]), budget (dropdown: Under £1k / £1k–£5k / £5k–£20k / £20k+), timeline (dropdown: ASAP / 1–3 months / 3–6 months / Flexible), message, and a GDPR consent checkbox linking to /privacy. Submit via PHP, send me a formatted HTML email via SMTP [details], auto-reply to the enquirer, and log everything to an enquiries MySQL table with a status column.

3. Multi-Step Quote Form

A 3-step progressive form with a visual step indicator. Ideal for agencies, consultants, and high-value services where upfront detail improves lead quality. Collects contact details, project requirements, and a summary review — all without page reload.

PHP MySQL SMTP Vanilla JS Progress bar
  • Step 1: Contact details (name, company, email, phone)
  • Step 2: Project requirements (type, description, budget, timeline)
  • Step 3: Summary review of all entered data + submit button
  • Vanilla JS step navigation with animated progress bar — no libraries
  • Required field validation before advancing — missing fields highlighted in red
  • PHP submits all steps at once: validates, stores to MySQL, sends SMTP email
Prompt to use with Claude

Build a 3-step quote request form for my site. Step 1: contact details (full name, company, email, phone). Step 2: project details (project type dropdown with options: [list your types], description textarea, budget dropdown, timeline dropdown). Step 3: a summary of everything entered plus a submit button. Show an animated progress bar above the form. Use vanilla JS to move between steps. Validate required fields before letting them advance. Submit via PHP to [email], log to MySQL, and send an auto-reply to the enquirer.

Security and reliability built in to every form

Claude writes the complete stack — not just the HTML. Every contact form pattern includes the PHP backend, database schema, and email delivery out of the box.

Spam protection

Honeypot hidden field (bots fill it, humans don’t) plus server-side rate limiting per IP address. No CAPTCHA friction for real users.

MySQL logging

Every submission is stored in a MySQL table. Claude creates the schema on deployment. You have a full audit trail of every enquiry your site receives.

SMTP delivery

Forms email directly via your SMTP credentials — no third-party email service required. TLS-supported with configurable from address and reply-to.

Input sanitisation

All inputs validated and sanitised server-side via PHP PDO prepared statements. SQL injection, XSS, and header injection are all mitigated before any data is stored.

← All building blocks Pricing table patterns

Deploy a contact form today

From £6.99/month. First month free — no credit card required. Pick a pattern above, open Claude, and paste the prompt. Your form will be live within minutes.