You can make the variables into a class and have the object call the same
function with all its variables.
Or turn magic quotes GPC on (and remove the addslashes() calls)

Oktay Altunergil

-----Original Message-----
From: Sterling [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 10, 2001 4:12 PM
To: PHP List
Subject: [PHP] StripSlashes


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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to