RE: [PHP] Help with addslashes and http post vars..

From: Date: Wed, 02 Aug 2000 14:10:03 +0000
Subject: RE: [PHP] Help with addslashes and http post vars..
Groups: php.general 
Request: Send a blank email to php-general+get-9691@lists.php.net to get a copy of this message
> right not i have to do > $firstname = addslashes($firstname); > for each variable, can i do something like > $HTTP_POST_VARS = addslashes($HTTP_POST_VARS); > then will all my varibles i use be fixeD? > like $firstname will have the slashes?? You could write a function that does this. Something like: (disclaimer: untested) function addSlashesToFormVars() { global $HTTP_POST_VARS; while( list( $key, $val ) = each( $HTTP_POST_VARS )) { $HTTP_POST_VARS[$key] = addslashes( $val ); } } This is assuming that you can actually modify the values within $HTTP_POST_VARS (it might be a read only var). If that is the case, just return an array to use instead of $HTTP_POST_VARS. Chris

« previous php.general (#9691) next »