RE: Passing Form As Argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, April 21, 2006 1:02 am, Nicolas Verhaeghe wrote:
> I'm new to the list so "Hello" to all. I'm drafting a function.php
> page, which will be included() in the pages in need. How would I pass
> a form as an argument of a function? From the name parameter of the
> form element or perhaps an ID:
>
>
> function checkForm(theForm){
> 	//Form validation code omitted.

You wouldn't.

See, you probably don't really want to pass every form through the
same validation function, because every form is different.

And every input should have the strictest validation possible for that
input.

So you can't really have a generic checkForm function, any more than
you can turn on your "Security" switch and magically make it safe.

It just plain doesn't work like that.

So your function, for now, should just know what form it is checking
because there is only one form it checks.


You might maybe some day want a big framework of standarized input
names and checks can be automated on some standard kinds of inputs. 
But that's a whole different animal from what I'm pretty sure you are
doing today.  And it never works all that well, imho, as there are too
many subtle differences in the needs for data validation.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux