Login   Register  
PHP Classes
elePHPant
Icontem

File: validation.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Kevin Burke  >  Validator.php  >  validation.php  >  Download  
File: validation.php
Role: Example script
Content type: text/plain
Description: validation test
Class: Validator.php
Form Validation class
Author: By
Last change:
Date: 10 years ago
Size: 758 bytes
 

Contents

Class file image Download
<?
require_once("Validator.php");

$validator = new Validator($_REQUEST);
$validator->filledIn("fname");
$validator->length("lname""<"15);
$validator->email("email");
$validator->compare("pass1""pass2");
$validator->lengthBetween("color"315);
$validator->punctuation($sentence);
$validator->value("age"">"18);
$validator->valueBetween("number"1116true);
$validator->alpha("car");
$validator->alphaNumeric("monitor");
$validator->date("date""mm/dd/yyyy");

$errors $validator->getErrors();
$id $validator->getId();
echo 
"Validator Id: $id<br><br>";
foreach(
$errors as $key => $value) {
    if(
strstr($key"|")) {
        
$key str_replace("|"" and "$key);
    }
    echo 
"<b>Error $value:</b> on field $key<br>";
}
?>