Ad block is installed and active. Please support us by disabling it.
HomeWednesday, April 25, 2018, 08:52:52

PHP Form Validation

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

$mail = $_POST['mail'];
$subject = $_POST['subject'];
$msg = $_POST['msg'];
$headers = 'From: System <[email protected]>';
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



Creating a basic bad word filter in PHP

This tutorial will show you how to create a basic bad word filter in PHP

Meta Tags Generator 1.1. PHP Script

This script will allow your visitors to create meta tags online.

Stack Overflow Clone Script - Ja2BU

Open source question and answer script written in PHP, MySQL and jQuery. Main features are: SEO friendly url's, private message system, rating system, comments system.


Getimagesize function will determine the size of any given image file and return the dimensions along with the file type and a height/width text string to be used inside a normal HTML IMG tag and the correspondant HTTP content type.

Smarty Paginate Example - Smarty Pagination with PHP

Smarty Paginate Example, Smarty Pagination with PHP. SmartyPaginate: a class/plugin for data set pagination within the Smarty template environment

PHP/MySQL Bookmarklet - PHP Tutorial

PHP/MySQL bookmarklet, bookmark current page, PHP/MySQL tutorial.

Preg_Match - PHP Email Validation

Validate email with preg_match in php

Advanced Contact Form - PHP Script

Advanced Contact Form with email and form field validation. Features: HTML Output(Response), Captcha Image.

Smarty - Create dynamic Web Pages with PHP & MySQL

Creating Dynamic Web Pages Using Smarty and MySQL - Requirement(s): PHP Server, MySQL

Addslashes - Stripslashes

addslashes — quote string with slashes, stripslashes — un-quotes a quoted string
About Author


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