StripSlashes

From: Date: Thu, 10 May 2001 20:11:38 +0000
Subject: StripSlashes
Groups: php.general 
Request: Send a blank email to php-general+get-52346@lists.php.net to get a copy of this message
H- I'd like to be able to strip the slashes from all the imported HTTP_POST_VARS. I found the $string = stripslashes($string); command. But this becomes very tedious if I have 20 vars and I need to code each one with its own stripslashes line. Which I am currently doing in a function. So I have two situations. One: function scrub_slashes(){ $email = stripslashes($email); $first_name = stripslashes(first_name); $last_name = stripslashes($last_name); $street1 = stripslashes($street1); $street2 = stripslashes($street2); $city = stripslashes($city); $zipcode = stripslashes($zipcode); } I'm not sure if I'm doing this function correctly. From what I understand I think I need to pass each variable to the function; which would negate the speedyness of my typing which is what I'm going for anyway. function scrub_slashes($email, $first_name, etc){ CODE } and it'd be called like so $scrub_error = scrub_slashes($email, $first_name, etc) I might as well copy paste the $email stripslashes($email); $first_name = stripslashes($first_name); in any location that it's needed. It might seem lazy but I really don't see why I need to dupe the code when I could put it into a function. Second situation: Is there a better way to pass all the variables into the function without typing out each one that's gonna be used in the function? Am I even using the function correctly? Am I confusing anyone? Thanks for any info or advice any can provide. Thoughts, Comments, Anecdotes? -Sterling

« previous php.general (#52346) next »