php - How can I set POST data to null if not alphanumeric? -


i posting allot of form data query. want set post data null or remove special characters if not alphanumeric , rest keep there values?

is there quick way can in bulk?

if (!isset($_post) || !ctype_alnum($_post)){  // post equals null  }else{  // nothing  } 

foreach($_post $key => $value) {     if (empty($value) || !ctype_alnum($value))     {         // remove non alphanumeric chars         $_post[$key] = preg_replace("/[^[:alnum:]]/i","",$value);      } } 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -