RajeshChaudhary345 / dropdown-check-list

Automatically exported from code.google.com/p/dropdown-check-list
0 stars 0 forks source link

Duplication of dynamic options #159

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
** What steps will reproduce the problem?
I am trying to use options from the database and I am using php.
here is my code
<select id="opts" class="select" multiple="multiple">
         <?php

foreach($sel as $f) {//array of all available options from database 
                                                                     foreach($sel1 as $cat1){//array of currently selected options

$selected=($cat1['file_id']==$f['file_id'])?'selected=selected':'';
 echo '<option value ="'.$f['file_id'].'" '.$selected.'>'.$f['file_name'].              '</option>';
}

                                }

        ?>
 </select>

** What is the expected output? What do you see instead?
I expect the drop down to show the options that have are selected to be checked 
and the ones not selected to be indicated.
However the result is that of duplication.I think the issue has to do with the 
looping.

** What is your environment?
-- DropDownCheckList version: 1.1
-- jQuery version:http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js
-- jQuery UI 
version:http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js
-- Browser and version:firefox 3.6.14

** Please provide any additional information below/Please attach sample
html

Original issue reported on code.google.com by vchi...@gmail.com on 7 Mar 2011 at 7:13

Attachments:

GoogleCodeExporter commented 8 years ago
jQuery and DDCL run in the client.  PHP runs in the server, which produces HTML 
which is then rendered in the client. 
If you have a sample of HTML code (whether produced by PHP or not is 
immaterial) that fails, then please post that code as an issue.

Original comment by womohun...@ittrium.com on 7 Mar 2011 at 2:44