Ad block is installed and active. Please support us by disabling it.
HomeSaturday, January 20, 2018, 16:58:56

PHP Form Validation

Tuesday, February 10, 15, 13:18:12, 3 Yaers Ago Via wain, Hits: 3487
PHP form validation :: PHP tutorial, requirement(s): PHP Server
Download source code:

$mail = $_POST['mail'];
$subject = $_POST['subject'];
$msg = $_POST['msg'];
$headers = 'From: System <>';
foreach ($name as $name)
if (ereg("^\<",$name)) {
echo "<center>Invalid Characters:
<a href=\"javascript:history.go(-1)\">Go Back</a></center>";
if (ereg("^\[",$name)) {
echo "<center>Invalid Characters:
<a href=\"javascript:history.go(-1)\">Go Back</a></center>";
if (ereg("^\$",$name)) {
echo "<center>Invalid Characters:
<a href=\"javascript:history.go(-1)\">Go Back</a></center>";
if (strlen($name) < 3) {
echo "<center>Field must be at least 3 characters long:
<a href=\"javascript:history.go(-1)\">Go Back</a></center>";
if (strlen($name) > 120) {
echo "<center>Max Characters in Field: 120
<a href=\"javascript:history.go(-1)\">Go Back</a></center>";
mail($mail, $subject, $msg,$headers);
echo "O.K.";
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script language="JavaScript">
function validationEmail(maForm) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(maForm.mail.value)){
return (true)
alert("Invalid E-mail Address! Please re-enter.")
return (false)
<form name="maForm" action="<?php echo $_SERVER['PHP_SELF']; ?>"
method="POST" onSubmit="return validationEmail(this)">
<input type=text name="mail" value="e-Mail"><br>
<input type=text name="subject" value="e-Mail subject"><br>
<input type=text name="msg" value="e-Mail message"><br>
<input type="submit" name="submit" value="submit">

Sign In



Bookmark Current Page - PHP Tutorial

Bookmark current page with PHP example.

PHP Cookies and Sessions Tutorial

PHP Cookies and Sessions Tutorials

PHP Links Script 1.1.

This script allows you to manage your links using a MySQL database. It features easy install, user submission, and an admin panel to add, edit and remove categories and links. The script is easy to customize to suit your needs.

PHP DateTimeZone

PHP representation of time zone

MySQL Basic Functions

MySQL Basic Functions - select, delete, update..

Show / Hide Div with CSS

CSS Display and Visibility:The visibility property specifies whether or not an element is visible.

Send This Link PHP Script

A popup form which allows your visitors to send a referral link from your site. It features admin notification and HTML output.

Creating a CAPTCHA with PHP with imagecreate

This tutorial will show you how to create a form with Captcha, Requirement(s): PHP Server, GD Graphics Library

HTML Button Generator

This script will allow your visitors to create HTML Buttons online. To use the "html button generator" script completely free , the "powered by" link at the bottom of the pages must stay intact.

Prevent the error loading XML – libxml_use_internal_errors

libxml_use_internal_errors() allows you to disable standard libxml errors and enable user error handling.
About Author


Date Registered: Sun, Feb 8, 15
Last Time Online: Thu, Jun 15, 17
So far has created 115 entries.
This author has not yet filled in any details.