input processor function

From: Date: Wed, 10 Jan 2001 19:45:55 +0000
Subject: input processor function
Groups: php.general 
Request: Send a blank email to php-general+get-33751@lists.php.net to get a copy of this message
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!

« previous php.general (#33751) next »