php - Call a function on Form Submit and then pass variables into the function -


i have php function strip dodgy characters may used maliciously.

<?php     function strip_tags_content($text, $tags = '', $invert = false) {          preg_match_all('/<(.+?)[\s]*\/?[\s]*>/si', trim($tags), $tags);          $tags = array_unique($tags[1]);           if(is_array($tags) , count($tags) > 0) {              if($invert == false) {                  return preg_replace('@<(?!(?:'. implode('|', $tags) .')\b)(\w+)\b.*?>.*?</\1>@si', '', $text);              }               else {                  return preg_replace('@<('. implode('|', $tags) .')\b.*?>.*?</\1>@si', '', $text);              }          }           else if($invert == false) {              return preg_replace('@<(\w+)\b.*?>.*?</\1>@si', '', $text);          }           return $text;      } ?> 

i have sign form above function , want pass every single form input through function have stripped of characters.

how this?

$stripped = array(); foreach($_post $index => $value){     $stripped[$index] = strip_tags_content($value); } 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -