Login   Register  
PHP Classes
elePHPant
Icontem

File: test_validator_4fields

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Josť Augusto Ferreira Franco  >  Validator4Fields  >  test_validator_4fields  >  Download  
File: test_validator_4fields
Role: Example script
Content type: text/plain
Description: Test script
Class: Validator4Fields
Validate values against several types of rules
Author: By
Last change:
Date: 8 years ago
Size: 1,474 bytes
 

Contents

Class file image Download
<?php

require_once("validator_class.php");

if(isSet(
$_POST['validar']))
{
    
$nome =  $_POST['nome'];
    
$email $_POST['email'];

    
$v= new validation();
    
#$v->is_empty(array("nome"=>$nome,"email" => $email),true);
    
$v->is_email($email);
    
#$v->is_secure_pwd($nome);
    #$v->msg_length($nome,10);
    #$v->empty_spaces(array("nome" => $nome));
    
$v->bad_words(array("nome" => $nome));
   

}


?>
<html>
<head>
<title>Validator Class</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>


<form name="form1" method="post" action="<?=$_SERVER['PHP_SELF']?>">
      <table border="0" cellspacing="0" cellpadding="2">
         <tr>
            <td>Nome:</td>
            <td ><input type="text" name="nome"></td>
         </tr>
             <tr>
            <td>Email:</td>
            <td><input type="text" name="email"></td>
         </tr>
         <tr>
            <td>Assunto</td>
            <td><input type="text" name="assunto" value="<?if(!empty($_POST['assunto'])){echo $_POST['msg'];}?>"></td>
          
         </tr>
         <tr>
            <td valign="top">Messagem:</td>
            <td><textarea name="msg"><?if(!empty($_POST['msg'])){echo $_POST['msg'];}?></textarea></td>
         </tr>
         <tr>
            <td>&nbsp;</td>
            <td><input type="submit" name="validar" value="Enviar email"></td>
         </tr>
      </table>
   </form>


</body>