fix the filter function to POST values

Now the filter part works every time, the old one would make nested array in POST array empty. Need to check if it is an array first. Also apply to GET,COOKIE,SESSION