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.

$this->request->getPost($name , $filters, $defaultValue); $defaultValue is not working

$this->request->getPost($name , $filters, $defaultValue);

like this code no set the defaultvalue

$data ['phone'] = $this->request->getPost(‘phone’ , 'int', '123456');
echo $data ['phone'] ; // out put  null 

this code outputs null, but I want the result : 123456

edited Aug '14
 * @param string $name
 * @param string|array $filters
 * @param mixed $defaultValue
 * @return mixed
public function getPost($name=null, $filters=null, $defaultValue=null){ }

$defaultValue how does it work?

edited Aug '14

defaultValue is applied if _POST phone doesn't exist, if you want add defaultValue if field is empty, set fourth parameter as true:

$this->request->getPost(‘phone’ , 'int', 123456, true);
     * @param string name
     * @param string|array filters
     * @param mixed defaultValue
     * @param boolean notAllowEmpty
     * @param boolean noRecursive
     * @return mixed
    public function get(string! name=null, filters=null, defaultValue=null, notAllowEmpty=false, noRecursive=false)


@Mariusz Łączak Hi Think you reply My carelessness; Didn't see was five arguments /*