Welcome Guest, Not a member yet? Register   Sign In
Multiselect Array Form Validation Problem
#1

[eluser]Unknown[/eluser]
Hello,

I'm trying to validate a multiselect array post with form validation class. But after validation, I have only the last item of the returning array...

I'm using Codeigniter 2.0.1...

construction of the form in viewer :
Code:
$skills = array('name' => 'skills[]', 'id' => 'skills', 'value' => ... 'options' => ...);
echo form_multiselect($skills['name'], $skills['options'], $skills['value']);

validation in controller :
Code:
$val = $this->form_validation;
$val->set_rules('skills[]', 'Skills', 'required');
$data['skills'] = $val->set_value('skills[]');

checking values :

Code:
print_r ($data['skills']) // returns :

6

// However, I'm waiting for an array as in $_POST.

print_r($_POST); // returns :

Array
(
    ...
    [skills] => Array
        (
            [0] => 4
            [1] => 6
        )
)

Where am I wrong ?


Messages In This Thread
Multiselect Array Form Validation Problem - by El Forum - 03-24-2011, 11:42 AM
Multiselect Array Form Validation Problem - by El Forum - 04-05-2011, 06:02 AM
Multiselect Array Form Validation Problem - by El Forum - 04-05-2011, 07:16 AM
Multiselect Array Form Validation Problem - by El Forum - 01-27-2013, 02:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB