Welcome Guest, Not a member yet? Register   Sign In
Passing data from dropdown to array
#1

[eluser]Michal1[/eluser]
Hello,

I am trying to pass a selected value from dropdown to array but I always get a value 0 even it should be char.

I have a dropdown in view:

Code:
<?php echo form_dropdown('categories', $options, 'first_cat');  ?>

Then in controller I am trying to get selected value from this dropdown and pass into:

Code:
function add_values()
                {
                    $data = array(
                    
                    'categories'=>$this->input->post('categories')    
                        );
                        
                        $this->admin_model->add_val($data);
                        
                }

Then I have of course a code in model for inserting data into db. But it does not work. Am I doing something wrong?


Messages In This Thread
Passing data from dropdown to array - by El Forum - 08-03-2011, 04:44 AM
Passing data from dropdown to array - by El Forum - 08-03-2011, 05:26 AM
Passing data from dropdown to array - by El Forum - 08-03-2011, 06:40 AM
Passing data from dropdown to array - by El Forum - 08-03-2011, 08:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB