PostHandler

The PostHandler class is intended to easily access the POST content. Therefore, the component uses the $_POST array.

The application of the static class looks as follows:

PHP code
// get a single post value $value = PostHandler::getValue('foo','bar'); // define a param array with default values $params = array('foo' => 'bar','baz'); // get several values $values = PostHandler::getValues($params);

The $value variable does contain the value of the post param foo. If the param is not contained in the POST-request, the value is bar. The array $values contains the value of the param foo within one offset, the offset baz includes the corresponding post value. In case the foo param is not found in the request, the default value is set to bar. If the baz param is not found, null is returned in that offset. Further details can be taken from the API documentation.

In order to use the component, it must be included using

PHP code
import('tools::request', 'PostHandler');

Comments

Do you want to add a comment to the article above, or do you want to post additional hints? So please click here. Comments already posted can be found below.
There are no comments belonging to this article.