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
Post a Comment