From 0ba58b81b65c2059210b921856489b5faaa81369 Mon Sep 17 00:00:00 2001 From: vascopj Date: Sun, 6 Feb 2011 14:20:21 +0000 Subject: 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 --- system/core/Input.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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); } -- cgit v1.2.3-24-g4f1b