robins
robins

Reputation: 1668

Dropdown always lists all values in codeigniter

My dropdown always lists all values all are visible every time.

view

<label>Choose Employees</label>
<select name="select_employee[]" multiple="multiple">
    <option disabled="disabled" selected>Select</option>
        <? foreach ($employee->result() as $var) 
            {?> 
                <option value="<?echo $var->emp_id;?>"><?echo $var->emp_name;?></option>
            <?}?>
</select>

This is the permanent view. Is this a css issue..? Removing the array symbol it exists proper view..but I want to keep it as an array.

initially vie this way

Upvotes: 4

Views: 750

Answers (2)

Sougata Bose
Sougata Bose

Reputation: 31749

<select name="select_employee[]" multiple="multiple" size="1"> will display two options.

Default value is 1 for single select. If the multiple attribute is present, the default value is 4

Upvotes: 2

Peter
Peter

Reputation: 933

You have multiple="multiple" in your code, which makes all the options visible because your user needs to be able to select more than one option.

Here is the documentation: http://www.w3schools.com/tags/att_select_multiple.asp

Upvotes: 0

Related Questions