Codeigniter Form Dropdown - Null Value

Hi All

I’m trying to add a dropdown field to one of my forms in CI via Ajax. All is good except the dropdown is receiving a NULL value upon form submit. The dropdown list is populated from a table in the DB and shows fine on the front end so i’m confused as to why it wont send the field to the statment. Its almost as if the statement is looking in the wrong place or i’ve put something in the wrong place.

i’ve poured through multiple sites but it doesnt seem to work for me :frowning:

Please can someone advise on if my code is incorrect:-

        $attributes = 'name="make", id="make", class="selectpicker", data-size="10", data-dropup-auto="false"';
        echo form_dropdown('manu_name', $manu_list, set_value('manu_name'), $attributes);

Thanks in advance.

Solved: I used a foreach loop instead of which retained the name and id attributes for the statement to insert into the db. :+1:t2:

1 Like