summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/helpers/form_helper.php32
1 files changed, 24 insertions, 8 deletions
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index 05616f707..0173340c5 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -103,19 +103,35 @@ if ( ! function_exists('form_open_multipart'))
*/
if ( ! function_exists('form_hidden'))
{
- function form_hidden($name, $value = '')
+ function form_hidden($name, $value = '', $recursing = FALSE)
{
- if ( ! is_array($name))
+ static $form;
+
+ if ($recursing === FALSE)
{
- return '<input type="hidden" name="'.$name.'" value="'.form_prep($value).'" />';
+ $form = "\n";
}
- $form = '';
+ if (is_array($name))
+ {
+ foreach ($name as $key => $val)
+ {
+ form_hidden($key, $val, TRUE);
+ }
+ return $form;
+ }
- foreach ($name as $name => $value)
+ if ( ! is_array($value))
+ {
+ $form .= '<input type="hidden" name="'.$name.'" value="'.form_prep($value).'" />'."\n";
+ }
+ else
{
- $form .= "\n";
- $form .= '<input type="hidden" name="'.$name.'" value="'.form_prep($value).'" />';
+ foreach ($value as $k => $v)
+ {
+ $k = (is_int($k)) ? '' : $k;
+ form_hidden($name.'['.$k.']', $v, TRUE);
+ }
}
return $form;
@@ -264,7 +280,7 @@ if ( ! function_exists('form_dropdown'))
$multiple = (count($selected) > 1 && strpos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : '';
$form = '<select name="'.$name.'"'.$extra.$multiple.">\n";
-
+
foreach ($options as $key => $val)
{
$key = (string) $key;