3

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

3
  • You want it to be multiselect? Commented Jun 18, 2015 at 5:10
  • remove multiple="multiple" and try may it's halp you. :) Commented Jun 18, 2015 at 5:12
  • @Arthi I don't get what you're asking for, and I might not be the only one. Commented Jun 18, 2015 at 6:03

2 Answers 2

2

<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

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.