Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Collect all post data at once

Hi,

I might be missing something in the docs, but is there a way to collect all Post data objects at once?

Right now, I get the Post data on a request like this:

$test->user = $this->request->getPost("user", "striptags");

Thanks for the help so far, Soda



15.9k
edited Aug '14

You can do it by this:

$all_post_data = $this->request->getPost(); // do not specify any arguments

It is described here http://docs.phalconphp.com/en/latest/api/Phalcon%5Http%5Request.html

Unfortunetely I don't know how to get whole post array with filtering at the same time. Maybe this will work $this->request->getPost(null,"someFilter");?



7.9k
Accepted
answer
edited Aug '14

You could just create your form using the Forms Builder http://docs.phalconphp.com/en/latest/reference/forms.html and add filtering/validation logic there as well: http://docs.phalconphp.com/en/latest/reference/validation.html http://docs.phalconphp.com/en/latest/reference/filter.html you can then validate your form against the submitted post request using $form->isValid($this->request->getPost())