problem with code to strip html characters from all POST data

From: Date: Fri, 01 Sep 2000 09:38:35 +0000
Subject: problem with code to strip html characters from all POST data
Groups: php.general 
Request: Send a blank email to php-general+get-14769@lists.php.net to get a copy of this message
Okay, I'm having some problems with the piece of code below. Basically I am trying to strip all html tags from all POST variables. I then use dynamically assigned variable names to overwrite the 'named variables' php creates with my stripped data. The code below works fine unless there is an array in the html form. In which case it doesn't actually remove the html tags, I assume this is because I am actually addressing an array within an array incorrectly. Although it appears to make the changes (the testing lines confirm this) they don't actually stand. I'm sure this is pretty simple stuff - But, I'm somewhat new to php and the way it handles arrays seems strange to someone who's background is in more traditional C programming. while (list($var, $value) = each($HTTP_POST_VARS)) { echo $var . '--' . $value . '<br>'; //for testing if(sizeof($value) > 1) //then its an array, so move through the values. { while(list($var2, $value2) = each($value)) { echo $var2 . '--' . $value2 . '<br>'; //for testing $value2 = strip_tags($value2); echo $var2 . '--' . $value2 . '<br>'; //for testing } } $value = strip_tags($value); $dynamic_var = $var; //assign it the variable name $$dynamic_var = $value; } Cheers, Rick Moynihan - MCL Software LTD

« previous php.general (#14769) next »