In my view I have a form select multiple box where I add items using a select dropdown and a button like this.
This is how the code of the select multiple box looks after adding 3 items to it.
<label for="nombresFamilia" class="col-md-4 control-label"></label>
<div class="col-md-6">
<select multiple id="nombresFamilia" name="nombresFamilia[]" class="form-control">
<option value="CABLES">CABLES</option>
<option value="PCR">PCR</option>
<option value="POSTES">POSTES</option>
</select>
</div>
After submitting the form information, I want to save the items inside the select multiple into an array. This is the code I have in my controller.
function add()
{
.
.
.
$this->form_validation->set_rules('nombresFamilia[]','NombresFamilia');
if($this->form_validation->run())
{
.
.
.
$params_familia = $this->input->post('nombresFamilia[]');
}
}
However, when I try to var_dump the array
<?php
echo "<pre>";
var_dump($params_familia);
echo "</pre>";
?>
I get the message: "Undefined variable: params_familia".
What am I doing wrong?