I'm trying to use this line of code to accept URL variables with spaces replaced by '%20' but it also has to go through a regex
$type=urldecode(ereg_replace("[^a-zA-Z0-9%]+", "", @$_REQUEST['type']));
The result is just the %20 removed instead of replacing with a space e.g JohnDoe not John Doe, from John%20Doe