Revision: 46981
Updated Code
at June 1, 2011 01:57 by bretticus
Updated Code
if (!function_exists('set_multi_value')) { /** * Repopulate form values when a muli-dimensional post array key is used. * * @param string $field * @param string $index * @param string $default * @return string */ function set_multi_value($field, $index=null, $default=null) { $CI = & get_instance(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (preg_match('/^([a-z0-9_-]+)\[([0-9]+)\]$/i', $field, $matches)) { return $CI->security->xss_clean($_POST[$matches[1]][$matches[2]]); } elseif (!is_null($index)) { return $CI->security->xss_clean($_POST[$field][$index]); } elseif (is_null($default)) { return $CI->security->xss_clean($_POST[$field]); } else { return $CI->security->xss_clean($default); } } elseif (!is_null($default)) { return $CI->security->xss_clean($default); } else { return ''; } } }
Revision: 46980
Updated Code
at June 1, 2011 01:54 by bretticus
Updated Code
if (!function_exists('set_multi_value')) { function set_multi_value($field, $index=null, $default=null) { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $CI = & get_instance(); if (preg_match('/^([a-z0-9_-]+)\[([0-9]+)\]$/i', $field, $matches)) { return $CI->security->xss_clean($_POST[$matches[1]][$matches[2]]); } elseif (!is_null($index)) { return $CI->security->xss_clean($_POST[$field][$index]); } elseif (!is_null($default)) { return $CI->security->xss_clean($_POST[$field]); } else { return $CI->security->xss_clean($default); } } } }
Revision: 46979
Updated Code
at June 1, 2011 01:52 by bretticus
Updated Code
if (!function_exists('set_multi_value')) { function set_multi_value($field, $index=null) { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $CI = & get_instance(); if (preg_match('/^([a-z0-9_-]+)\[([0-9]+)\]$/i', $field, $matches)) { return $CI->security->xss_clean($_POST[$matches[1]][$matches[2]]); } elseif (!is_null($index)) { return $CI->security->xss_clean($_POST[$field][$index]); } else { return $CI->security->xss_clean($_POST[$field]); } } } }
Revision: 46978
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 28, 2011 09:20 by bretticus
Initial Code
if (!function_exists('set_multi_value')) { function set_multi_value($field, $index=null) { $CI =& get_instance(); if (preg_match('/^([a-z0-9_-]+)\[([0-9]+)\]$/i', $field, $matches)) { return $CI->security->xss_clean($_POST[$matches[1]][$matches[2]]); } elseif (!is_null($index) ) { return $CI->security->xss_clean($_POST[$field][$index]); } else { return $CI->security->xss_clean($_POST[$field]); } } }
Initial URL
Initial Description
CodeIgniter Helper function to repopulate form values when a muli-dimensional post array key is used.
Initial Title
CodeIgniter Helper Function: set_muli_value
Initial Tags
php, codeigniter
Initial Language
PHP