1

I want to create 2 dropdown list. First of them includes main categories, second one includes subcategories.

In codeigniter view i have this lines:

<table>
<tbody>
    <tr>
        <td><label>Top Level Option</label></td>
        <td><?php echo form_dropdown('options', $options, '#', 'id="options"'); ?></td>
    </tr>
    <tr>
        <td><label>Sub Level Option</label></td>
        <td><select name="suboptions" id="suboptions"><option value="#">-- Please Select Sub-option --</option></select></td>
    </tr>
</tbody>

But i have an error in echo form_dropdown() line:

Fatal error: Call to undefined function form_dropdown().

How can I use this form_dropdown()?

0

1 Answer 1

3

You need to load the form helper file at first.

Whether to use $this->load->helper('form') within the Controller (in which you load the view file)

Or to load the helper automatically by adding the name of the helper to $autoload array config:

application\config\autoload.php

$autoload['helper'] = array('form');
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.