Re: Filter input

From: Date: Thu, 11 Oct 2007 15:17:26 +0000
Subject: Re: Filter input
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-263107@lists.php.net to get a copy of this message
On 10/11/07, Jim Lucas <lists@cmsws.com> wrote: > What are you wanting to validate? > > Do you want a package/class/function set that when called will validate different types of > input? > Email, string, int, etc... Basically yes. I want to validate: - type: (string, int, float, ..) - characteristics (length, allowed characters, ...) - nature (email, ISBN, ...) I also want this lib. to let me define my own rules. For instance, I'm dealing with parameters that looks like 'field_33', 'field_1', 'label', 'title' I want to be able to tells: validate stuff that match: - (field_[0-9]+ or [a-z]+) and maybe in some cases - (field_[0-9]+ or label or title) The thing that remains not very clear to me is where validation stop and where application logic start. Example: A given 'item' (value = 7) have 3 'fields': - field_33 - field_5 - label When it comes to validate the fields value of the item '7' should I validate 'field' against - ('field_33', 'field_5', 'label') -> I validate the data are well formed AND coherent. or -('field_[0-9]+', [a-z]+) -> I only care about the form and I let the "application part" deal with coherency later. I don't know if I'm clear enough!

« previous php.general (#263107) next »