Documentation

Light-weight, fast, simple and powerful!
 
Translations of this page?:

Validate.php helper

Introduction

Validate helper is for validating fields, like in the example below for email.

<form action="<?php echo $this->url(); ?>" method="post">
E-mail: <input type="text" name="email" />
<input name="submit" type="submit" value="Submit" />
</form>
 
<?php
use_helper('Validate');
$email = isset($_POST['email']) ? htmlentities($_POST['email'], ENT_QUOTES, "UTF-8") : '';
if(isset($_POST['submit'])):
   if(Validate::email($email)== true):
       echo '<h3>Valid e-mail</h3>';
     else:
       echo '<h3>Invalid e-mail!</h3>';
   endif;
endif;
?>

It also has support for:

  • email()
  • email_domain()
  • email_rfc()
  • url()
  • phone()
  • date()
  • datetime()
  • alpha()
  • alpha_numeric()
  • alpha_dash()
  • alpha_comma()
  • slug()
  • alpha_space()
  • alphanum_space()
  • digit()
  • numeric()
  • range()
  • decimal()
  • color()
  • multiple()
  • valid_utf8()
  • compliant_utf8()
 
helpers/validate.txt · Last modified: 2012-02-15 18:19 by normanu
 
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
Copyright 2010 wolfcms.org / design by yello studio / Wolf CMS Inside