Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Transform checkboxes into simple dropdown
#1

[eluser]Ludovic-r[/eluser]
Hi !

I need your help for something I'm stuck for days now, let me explain :

I have a simple foreach loop which retrieve informations from DB to populate the checkboxes :

Code:
if (isset($result)) {
        
        foreach($result as $row) {
        echo $row->category_name;
            $data = array(
                'name'        => 'category',
                'id'          => 'id_'.$row->cat_id,
                'value'       => $row->cat_id,
                'checked'     => FALSE,
                );
    echo form_checkbox($data);
        }

Then, this is retrieved in my controller like this :

Code:
$cat_id = $this->input->post('category');

It works well but I need a dropdown menu instead of checkboxes ! And I can't figure it out Sad
Any help would be very very appreciated ! Thanks !!




Theme © iAndrew 2016 - Forum software by © MyBB