diff options
author | vascopj <devnull@localhost> | 2011-02-06 15:20:21 +0100 |
---|---|---|
committer | vascopj <devnull@localhost> | 2011-02-06 15:20:21 +0100 |
commit | 0ba58b81b65c2059210b921856489b5faaa81369 (patch) | |
tree | c55e93984720dfd69740763cdaa395835773d595 | |
parent | 58e8caf2afb3ea054f83999fb0698720a1a58738 (diff) |
A change to pass all fields back if there are no fields passed into the "post" method.
Based on comments here
http://codeigniter.uservoice.com/forums/40508-codeigniter-reactor/suggestions/1346917-allow-this-input-post-to-return-array-of-eve
-rw-r--r-- | system/core/Input.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/system/core/Input.php b/system/core/Input.php index 3e82874fd..fa8080deb 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -126,6 +126,22 @@ class CI_Input { */ function post($index = '', $xss_clean = FALSE) { + // check if a field has been entered + if( empty($index ) ) + { + // no field entered - return all fields + + $all_post_fields = array(); + + // loop through the full _POST array + foreach( $_POST as $key ) + { + $all_post_fields[$key] = $this->_fetch_from_array($_POST, $key, $xss_clean); + } + return $all_post_fields; + + } + return $this->_fetch_from_array($_POST, $index, $xss_clean); } |