I am trying to implement proper a Post Redirect Get on a PHP site (question is language agnostic in nature however). I thought about it, and realized that running this code on every request seems to give me the behavior I'm seeking.if (! empty($_POST)){    header(Location: http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]);}Essentially, if there was a post, redirect to the page we're currently on. This is in the context of a routing framework. I run it before the rest of my code.Is this bad practice? If so, why? Are there situations when this would cause unexpected behavior? Can this code be improved?
Can this be used to implement Post Redirect Get pattern?
design patterns;php;code quality;coding standards