Welcome Guest, Not a member yet? Register   Sign In
Form Problem. CI Form_Dropdown Issue

[eluser]Deep Arora[/eluser]
Here's what I am doing:

In my controller:

$options = array(
                  'small'  => 'Small Shirt',
                  'med'    => 'Medium Shirt',
                  'large'   => 'Large Shirt',
                  'xlarge' => 'Extra Large Shirt'

$form_field_category = "category|Link Category|dropdown|small|" . $options;
$view_fields = array(form_field_category);
create_form($view_fields, 'form_path', 'form_name', 'perm_add');

So, I have created an array of values to be set for a dropdown form field in controller. Then I call create_form function from helper.

Inside this function:

$form_field = explode("|", $value);
if ($form_field[4]): $field_value = $form_field[4];
else : $field_value = set_value($form_field[0]);

since I have passed the VALUE field (as $options) from my controller, the form_field[4] should now have that array.

Then while I generate the form field in the same function as;

$my_form = $my_form . "<div>". form_dropdown($form_field[4], $form_field[4]);

..it gives an error

Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: helpers/form_helper.php

Line Number: 310

I tried printing the array in form_filed[4] and all it prints is the word ARRAY.

What could be wrong?

Messages In This Thread
Form Problem. CI Form_Dropdown Issue - by El Forum - 02-09-2010, 09:36 PM
Form Problem. CI Form_Dropdown Issue - by El Forum - 02-10-2010, 02:53 AM

Theme © iAndrew 2016 - Forum software by © MyBB