I want to process information submitted by a form, but I want to clean up
the info before I use it.   I have about 40 form fields, of several field
types.  If I only had a few form fields, I would do ths manually, but since
I have so many my code will be much neater to do it with a function.  I want
to loop through all the POST vars and do a strip_tags() and trim() on each
one.

Is this how I should be doing this?  The code below works how I want it to.
However, I would prefer, for performance/memory issues to not perform this
on unneeded fields, such as radio buttons and select boxes where the
information is already formatted how I want.  Is there any way to only
perform this on text boxes and textarea fields?  THanks!

foreach ( $HTTP_POST_VARS as $key=>$value )
 {
$value=strip_tags($value);
$value=trim($value);
// for debugging use only  print all the variables from web form
 print "$key = $value<br />";
 }

-----------------------------------------------------------------
Jonathan Rosenberg
Be fierce, be fabulous, change the world!





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to