At 3:46 PM -0700 4/20/06, Chris Kennon 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 can't pass the form, but you can pass the form content, which is
probably what you want anyway.
If it were me, I would place a form value ($theForm) in each fomr as
a <input> hidden variable that would identify which form and I would
pass that to your checkForm($theFrom) function.
From there, I would set up a switch which would channel your
validation. The variables to validate, of course, would be in your
$_POST or $_GET arrays. That should be simple enough.
Also, I seem to recall some caution is needed when using
user-defined functions?
No more so than any other syntax, just do it right.
tedd
--
--------------------------------------------------------------------------------
http://sperling.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php