Something so simple, let’s say even in a framework like Symfony which I use all the time you want to just check to see if the incoming request was initiated by an actual form post. Here’s the best way to check:
1 2 3 | if ($_SERVER['REQUEST_METHOD'] == 'POST') { //Do something unique here like redirect or pass post data to another method } |
I implement this switch in a lot of handlers where I deploy API clients that deliver forms on a site but the forms aren’t actually built from the site — the API pulls the form from some centralized controller.