As the manual explains, the problem with code like that is that you don't always want to escape everything. Plus, doing so destroys data integrity.
If you later echo() something that was POST'ed, it will be escaped, resulting in things such as "Hello Mr. O\'Reilly!". Plus, that code doesn't take into consideration if magic_quotes_gpc is enabled or not thus running the risk of double escaping the data.
Basically, I only escape the data as I'm putting it into a SQL query. Quick example:
$query = sprintf("SELECT col1 FROM users WHERE userid = %d OR username = '%s'",
$_POST['id'],
mysql_real_escape_string($_POST['name'])
);
Note that in my above example, if you were to simply use [man]mysql_real_escape_string/man on $_POST['id'] then you would still run the risk of your query being altered slightly - that's why I forced the numeric data to be a numeric type (in this case using sprintf() - other times I'll just cast it to an (int)).