Php cause file download

I've seen many download scripts written in PHP, from simple one-liners to dedicated classes. Yet, at least half of them share common errors; in many cases 

A valid parameter will cause the PHP (on this secondary GET) to initiate a file download, while an invalid parameter will cause the PHP to emit an error webpage, which will display in the original Posts