PHP Classes

Use this class ONLY for validation

Recommend this page to a friend!

      PHP Forms Class with HTML Generator and JavaScript Validation  >  PHP Forms Class with HTML Generator and JavaScript Validation package blog  >  How to Show Google Ma...  >  All threads  >  Use this class ONLY for validation  >  (Un) Subscribe thread alerts  
Subject:Use this class ONLY for validation
Summary:Is it possible to use this class only for validation purposes?
Messages:3
Author:Chirs
Date:2007-08-08 09:25:04
Update:2007-08-16 22:32:47
 

  1. Use this class ONLY for validation   Reply   Report abuse  
Picture of Chirs Chirs - 2007-08-08 09:25:05
Thank you for excellent validation functions of your forms class. Our forms are embedded in our hand-written html. So, to create the form itself, I don't have any use for your form class. But when the form is submitted, I would like to use the excellent validation functions to filter input. For example:

<?php

$_POST = array_walk($_POST, 'my_XSS_Filter');

require("forms.php");
$form=new form_class;

$error_txt = '';

if ($form->someValidationFunction($_POST['email'], 'ValidateAsEmail'))
{ $verified_email = $_POST['email'];
}else
{ $error_txt .= 'Please enter valid email. <br />';
}

if ($form->someValidationFunction($_POST['credit_card'], 'ValidateAsCreditCard'))
{ $verified_credit_card = $_POST['credit_card'];
}else
{ $error_txt .= 'Please enter valid credit card. <br />';
}

//Repeat such if statements for every input field of the form

if ($error_txt == '')
{ // process form }
else
{ // process error }

?>


In other words, is there a way to use your "Forms generation and validation" class for just "validation only"? We already have a system for "Forms generation" and need an excellent validation class for checking incoming data on server-side. (We do not perform client-side validation).

Thank you very much for your time.

  2. Re: Use this class ONLY for validation   Reply   Report abuse  
Picture of Chirs Chirs - 2007-08-10 06:34:42 - In reply to message 1 from Chirs
Hey Manuel,

So, can this class be used for "Validation ONLY" purposes?

Thanks for your help.

  3. Re: Use this class ONLY for validation   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-08-16 22:32:47 - In reply to message 1 from Chirs
Sure, just use the AddInput, LoadInputValues and Validate functions for server side validation purposes.