help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%

PHP Contact Form

Server-side contact form with PHP validation, email sending, MySQL storage. Honeypot, rate limiting, math CAPTCHA, auto-reply, reference number. By rskworld.in.

PHP Validation Email MySQL Honeypot CAPTCHA Auto-reply Security
Download Contact Form Live Demo RSK View Files
PHP Contact Form - RSK World
PHP Contact Form - RSK World
PHP Validation Email MySQL Security

PHP Contact Form provides server-side validation, sanitization, and email sending. Features: name, email, optional phone (with format validation), subject dropdown, priority (Low/Normal/High/Urgent), message with live character counter (10–5000 chars). Spam protection: honeypot, session-based rate limiting (e.g. 3 submissions per 5 min per IP), math CAPTCHA. Optional MySQL storage (contact_submissions table) with reference #ID; auto-reply email to the user. All inputs sanitized (XSS); configurable via config.php. By rskworld.in.

If you find this PHP Contact Form useful, you can support with a small contribution.

Secure Fast Trusted
Pay via UPI QR
Scan or tap an amount to auto-generate
UPI QR
₹
Open UPI app
GPay PhonePe Paytm
Download Contact Form

Form Fields & Validation

Name (min 2 chars), email, optional phone (8–20 chars), subject dropdown, priority (Low/Normal/High/Urgent), message (10–5000 chars) with live character counter.

  • Server-side validation – name, email, phone, subject, message
  • Sanitization – htmlspecialchars, trim, filter_var for email
  • Phone optional with format validation (digits, spaces, +, -, parentheses)
  • Priority levels configurable in config.php (PRIORITY_LEVELS)
  • Message min/max length and character counter in script.js
  • Subject dropdown: General Inquiry, Technical Support, Feature Request, Bug Report, Other
  • Form repopulates on validation errors via GET params

Project Structure & Files

index.php (form page), process.php (POST handler), config.php (DB, email, security flags), includes/functions.php (validation & helpers), assets/css & js.

  • index.php – form HTML, success/error alerts, CAPTCHA, repopulation
  • process.php – honeypot, rate limit, CAPTCHA, validation, DB insert, mail, redirect
  • config.php – USE_LOCAL_DB, DB_*, ADMIN_EMAIL, ENABLE_HONEYPOT, ENABLE_MATH_CAPTCHA
  • includes/functions.php – sanitize_*, validate_*, generate_math_captcha, check_rate_limit
  • database.sql / database-local.sql – contact_submissions, rate_limit_log
  • database-update.sql – add phone, priority columns for existing DBs

Security & Spam Protection

Honeypot field (hidden), session-based rate limiting, math CAPTCHA ("What is 3 + 5?"). All output escaped; inputs sanitized.

  • Honeypot – website_url field hidden; if filled, treat as bot and redirect
  • Rate limit – RATE_LIMIT_MINUTES, MAX_SUBMISSIONS_PER_IP (e.g. 3 per 5 min)
  • Math CAPTCHA – random sum stored in session, validated on submit
  • get_client_ip() – supports CF, X-Forwarded-For, X-Real-IP, REMOTE_ADDR
  • record_submission() – appends timestamp to session for rate window
  • For production: consider CSRF tokens or reCAPTCHA (README)

Email & Auto-Reply

Submissions sent to ADMIN_EMAIL via PHP mail(). Optional auto-reply confirmation to the user with reference number.

  • Admin email – config: ADMIN_EMAIL, FROM_EMAIL, FROM_NAME, SITE_NAME, SITE_URL
  • Plain text body: name, email, phone, subject, priority, message, ref #, IP, time
  • Reply-To set to submitter email for easy reply
  • ENABLE_AUTO_REPLY – sends confirmation to user with ref # and support info
  • Success redirect: index.php?success=1&ref=; error redirect with message and field params

Database Integration

Optional MySQL (PDO). contact_submissions table; last insert ID shown as reference number. Supports local (Laragon) or Byet hosting.

  • USE_LOCAL_DB – true for local (php_contact_form), false for Byet (b11_41100569_1)
  • INSERT into contact_submissions: name, email, phone, subject, priority, message, ip_address, user_agent
  • Reference #ID in success message and in admin/user emails
  • On PDO failure, DEBUG mode shows error message; otherwise silent
  • database.sql – Byet; database-local.sql – CREATE DATABASE + tables for local

What You Get

Full PHP contact form source: form page, processor, config, validation helpers, CSS, JS, SQL schemas, README, CHANGELOG, LICENSE.

  • Complete source – php-contact-form/ folder with index.php, process.php, config.php
  • includes/functions.php – all validation and sanitization helpers
  • assets/css/style.css, assets/js/script.js – form styling and character counter
  • database.sql, database-local.sql, database-update.sql
  • README.md – features, installation, security notes
  • MIT License. © 2026 Molla Samser (RSK World).

Contact Form Application

PHP 7.4+, MySQL 5.7+ (optional), web server (Apache/Laragon/XAMPP). Configure config.php and import SQL; open index.php.

  • php-contact-form/ – main app folder
  • index.php – contact form UI; process.php – POST handler
  • config.php – DB credentials, ADMIN_EMAIL, security toggles
  • Import database.sql or database-local.sql; set USE_LOCAL_DB and DB_*
  • Set ADMIN_EMAIL, FROM_EMAIL; ensure PHP mail() or SMTP works
  • Author: Molla Samser | rskworld.in

Validation & Sanitization

functions.php: sanitize_string, sanitize_email, sanitize_phone; validate_name, validate_email, validate_phone, validate_subject, validate_message.

  • validate_name – trim, length >= 2, pattern letters/spaces/hyphen/dot (Unicode)
  • validate_email – filter_var FILTER_VALIDATE_EMAIL
  • validate_phone – optional; 8–20 chars, digits/spaces/+/−/(); at least 6 consecutive digits
  • validate_subject – non-empty, max 150 chars
  • validate_message – 10–5000 chars (mb_strlen)
  • Message stored with htmlspecialchars in process.php

Project Features

Server-side validation, email, optional MySQL, honeypot, rate limiting, math CAPTCHA, phone field, priority, auto-reply, reference number, character counter.

  • Form – name, email, phone, subject, priority, message
  • Spam – honeypot, rate limit, math CAPTCHA
  • Email – admin notification + optional user auto-reply
  • DB – contact_submissions, ref # on success
  • UX – char counter, repopulation on error, success/error alerts
  • Security – sanitization, escaped output

Credits & Acknowledgments

PHP Contact Form by RSK World. Built for learning PHP backend development. Core technologies credited below.

  • PHP – server-side validation, mail, sessions, PDO
  • MySQL – contact_submissions storage
  • RSK World – Project creator and educational platform
  • Author: Molla Samser (Founder - RSK World)
  • Website: https://rskworld.in
  • Email: help@rskworld.in | support@rskworld.in
  • Phone: +91 93305 39277
  • © 2026 RSK World. All rights reserved.

Support & Contact

For contact form customization or integration help, please contact us.

  • Email: help@rskworld.in, support@rskworld.in
  • Phone: +91 93305 39277
  • Website: RSKWORLD.in
  • Location: Nutanhat, Mongolkote, Purba Burdwan, West Bengal, India - 713147
  • Author: Molla Samser (Founder, RSK World)
  • PHP Contact Form - README, CHANGELOG, RELEASE_NOTES, CONTRIBUTING
  • Technical Support Available
  • PHP & Backend Integration Requests Welcome
Featured Content
Additional Sponsored Content

Download Contact Form

Get the complete PHP Contact Form project. You can view the files or download the source code directly.

Download Contact Form

Quick Links

Live Demo - Run Contact Form Click to explore
Download Contact Form Click to explore
View Files (Browser) Click to explore
Explore All Creative Projects by RSK World Click to explore
Explore All PHP & Backend Projects by RSK World Click to explore

Categories

PHP Validation Email MySQL Security

Technologies

PHP
MySQL
Email
Security
Validation

Featured Projects

PHP & Backend Projects by RSK World

AI Chatbot GPT Integration OpenAI API Python Flask Web UI Chat History
E-commerce Platform - rskworld.in
E-commerce Platform
PHP Projects

Complete e-commerce platform with shopping cart and payment.

View Project
Android Calculator App - rskworld.in
Android Calculator App
Java Projects

Native Android calculator using Java and Android SDK.

View Project
C# Web API - rskworld.in
C# Web API
C# Projects

RESTful web API built with C# and .NET Core.

View Project
Basic Form - rskworld.in
Basic Form
Web Development

Simple HTML form with validation and styling.

View Project
SQL Database Manager - rskworld.in
SQL Database Manager
SQL Projects

Database management system with SQL and multiple database support.

View Project
View All Projects

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer

Support This Free Project

This project is completely free to download!

If you find it useful, consider supporting us with a small donation. Your support helps us create more free projects.

Pay via Razorpay

If you find this PHP Contact Form useful, you can support with a small contribution.

Secure Fast Trusted
Payment Successful! Your download will start automatically...
Pay via UPI QR
Scan or tap an amount to auto-generate
UPI QR
₹
Open UPI app
GPay PhonePe Paytm