![Picture of Chirs Picture of Chirs](/graphics/unknown.gif)
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.