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.
- 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_submissionsMySQL table with timestamp, IP, and message body- Success/error messaging via fetch API — no page reload
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.
- 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
enquiriesMySQL table withstatuscolumn (new / contacted / closed)- Auto-responder confirmation email sent back to the enquirer
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.
- 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
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.
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.