$request = $this->getRequest(); if ($request->isPost()) { // process form data }
if (!$this->getRequest()->isPost()) { // redirect to error page }This code snippet checks whether the current request is a POST request and redirects to an error page if it is not. Package library: Zend Framework.