RE: Passing Form As Argument

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

 




Hi,


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.




}


Also, I seem to recall some caution is needed when using user-defined  
functions?

--------------------------

I always try to do server-side and client-side verification.

Client-side with javascript, server-side with PHP.

The coolness with Client-side verification is that it saves the server's
bandwidth and processing time and if you use a focus function you can place
the cursor to where the first error has been spotted.

The issue here is that someone one day makes a mistake you did not think of.
Or someone hacks the form and recreates an html version locally to just piss
you off and try to fill your database with garbage. Or simply hammer your
site with 1 million times the same flawed form to see what happens.

Hence the need for server-side verification as well.

Another plus is that you can do some more complex verifications in PHP. For
instance comparing the zip code with the state by querying a state/zip code
database.

Or even talk to a credit card processor to make sure that the credit card is
valid and has cash, while all the javascript can do is verify the
plausibility of the credit card number.

I am now "AJAX"ing some of my server-side verifications to make it seem like
it is client-side, the goal here is to save time and bandwidth.

-- 
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