Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/10/2011, 14:16
rcastellanossuarez
 
Fecha de Ingreso: enero-2011
Mensajes: 74
Antigüedad: 13 años, 11 meses
Puntos: 4
problema con select multiple

Hola :
Tengo un problema y es que estoy usando un select de html con la opción multiselect habilitada para asignar categorias a un producto pero en la pagina de edición no se como cargar o repoblar este componente , no es repoblarlo usando la clase form_validator lo que necesito, sino cargar las categorias asociadas a mi producto en base de datos en el select multiple. gracias de antemano

Código PHP:
<select name="categories[]" id="id_category" multiple="multiple" style="height: 200px;">                                                                                          
                                            <?php 
                                            $first_letter_default
='';
                                            foreach (
$categories->result_array() as $category) { 
                                              
$now=$this->commons->clean_characters_input($category['category_name']); 
                                              
$first_letter=mb_substr($now,0,1);
                                              if(
$first_letter_default!=$first_letter){ 
                                              
$first_letter_default=$first_letter
                                            if(
$first_letter_default!=''){?>
                                            </OPTGROUP>
                                            <?php ?>
                                            
                                            <OPTGROUP label="<?php echo $first_letter?>" style="padding-left: 10px;">
                                            <option value="<?php echo $category['id_category']; ?>"><?php echo $this->commons->clean_characters_input($category['category_name']) ?></option>                                                                                         
                                            
                                            <?php    
                                              
}else{                                                  
                                                  
?>
                                              <option value="<?php echo $category['id_category']; ?>"><?php echo $this->commons->clean_characters_input($category['category_name']) ?></option>                                                                                         
                                               <?php    
                                              
}                                                                                                                                    
                                             } 
?>                                          
                                        </select>