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

From: Date: Wed, 02 Aug 2000 14:06:32 +0000
Subject: RE: [PHP] Help with addslashes and http post vars..
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-9693@lists.php.net to get a copy of this message
Thanks for the help, while that does work, kinda. That sets $HTTP_POST_VARS[firstname] witht he add slashes, and it works, but it doesnt fix $firstname , doe sthat mean i will have to re-asign the value to each variable? Chris On Wed, 2 Aug 2000, Boget, Chris wrote: > > 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 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#9693) next »