[Solved] input form check for $_POST or $_GET array [closed]


Use $_REQUEST which contains both POST and GET variables.

public function get($item) {
    if (!empty($_REQUEST[$item])) {
        $_REQUEST[$item] = filter_var($_REQUEST[$item], FILTER_SANITIZE_SPECIAL_CHARS);

        return is_numeric($_REQUEST[$item]) ? (int) $_REQUEST[$item] : $_REQUEST[$item];
    }
    return '';
}

1

solved input form check for $_POST or $_GET array [closed]