RE: [PHP] Passing Form As Argument

From: Date: Fri, 21 Apr 2006 21:56:09 +0000
Subject: RE: [PHP] Passing Form As Argument
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-234528@lists.php.net to get a copy of this message
From: Richard Lynch [mailto:ceo@l-i-e.com] Sent: Friday, April 21, 2006 2:15 PM To: Nicolas Verhaeghe Cc: php-general@lists.php.net Subject: RE: [PHP] Passing Form As Argument 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. ----------------------- I have functions which dynamically generate client-side javascript validation functions according to the name of the field, its type (text, password, email, drop down, radio button, textarea, and what not). Same thing server-side. TIMTOWTDI but I cannot be the only one with the idea.

« previous php.general (#234528) next »