Input.post
Input.post($fieldName, $ruleset='id') -> any
Description
Get an input field value sent via HTTP POST
(usually via a form or Ajax request).
It will be validated per the given $ruleset
. (See Input Validation)
If it does not pass validation, a default value will be returned for its type.
// POST: name=Tal+Thorson&age=33 Input.post('name', 's') //= 'Tal Thorson' Input.post('age', 'i|max: 130') //= 33 Input.post('favoriteColor', 's') //= '' (default) Input.post('heightCm', 'i') //= 0 (default)
SecurityAll POST requests must come from the current domain and contain a CSRF Token. To lift these restrictions for a page and allow calls from the outside, its path must begin with
/api/
.