HTTP_POST_VARS and passing by reference

From: Date: Thu, 17 Jan 2002 17:14:13 +0000
Subject: HTTP_POST_VARS and passing by reference
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-80940@lists.php.net to get a copy of this message
Hello, I'm attempting to make a function to which I can pass my form variables, to wit: clean_input($HTTP_POST_VARS); which will run through the array and clean up the variables. However, the passing by reference is giving me the screaming fits. No matter what I do, I can't seem to get the function to alter the actual array, and not a copy of it. I tried it with arraywalk(), but that produces a copy of the array, so I'm trying each() and list() like this: function clean_input(&$form_vars) { reset($form_vars); while ($element = each($form_vars)) { trim(strip_tags(stripslashes($element[1]))); } } but this just makes another copy. HTTP_POST_VARS still contains the ugly, raw input. Putting an "&" in front of $element in the while loop caused the script to crash. I know there should probably be another "&" somewhere, but I can't figure out where. Any help would be appreciated! -bryan ===== --------------------------------------------------------------------------- Schrodinger may have slept here. --------------------------------------------------------------------------- __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/

« previous php.general (#80940) next »