Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/08/2015, 11:41
Cristhor1982
 
Fecha de Ingreso: enero-2013
Ubicación: Puerto Montt
Mensajes: 13
Antigüedad: 11 años, 4 meses
Puntos: 0
Capturar datos de CheckBox

Necesito capturar todos los datos seleccionados en checkbox...como lo hago aca el codigo
Código PHP:
 <?php  
    
while ($row odbc_fetch_array($result)) {
                if ((
$row['WEBCONNECT']=='1')){
                echo 
'<td> <img src="images/tourplan.jpg" /></td>';
                }
                elseif ((
$row['WEBCONNECT']=='2')){
                    echo 
'<td> </td>';
                }
                echo 
'<td>'.utf8_encode($row['NAME']).'</td>';
                echo 
'<td>'.utf8_encode($row['NAME_SUP']).'</td>';
                echo 
'<td>'.utf8_encode($row['NAME_SERVICE']).'</td>';
                echo 
'<td>'.utf8_encode($row['CODE']).'</td>';
                echo 
'<td>'.utf8_encode($row['DESCRIPTION']).'</td>';
                if(
$radio == '1') {
                echo 
'<td><input name="seleccion[]" id="seleccion" type="checkbox" value="'.$row['CODE'].'>'.$row['DESCRIPTION'].'>'.$row['OPT_ID'].'>'."ENGLISH".'" /></td>';
                }
                else if (
$radio=='2'){
                echo 
'<td><input name="seleccion[]" id="seleccion" type="checkbox" value="'.$row['CODE'].'>'.$row['DESCRIPTION'].'>'.$row['OPT_ID'].'>'."ALEMAN".'" /></td>';
                }
                else if (
$radio=='3'){
                echo 
'<td><input name="seleccion[]" id="seleccion" type="checkbox" value="'.$row['CODE'].'>'.$row['DESCRIPTION'].'>'.$row['OPT_ID'].'>'."ESPANOL".'" /></td>';
                }
                else if (
$radio=='4'){
                echo 
'<td><input name="seleccion[]" id="seleccion" type="checkbox" value="'.$row['CODE'].'>'.$row['DESCRIPTION'].'>'.$row['OPT_ID'].'>'."PORTUGUES".'" /></td>';
                }         
                echo 
'</tr>';
                            
    }
    
?>
aca toma la seleccion...luego lo envio a traves de la funcion

Código PHP:
<script>
$(
document).ready(function(){    
        $(
'#subir').click(function(){                         
            $(
"#seleccion:checked").each(function(index)
            {
                
datosch=($(this).val());
                
alert (datosch);
                $(
"#destino1").click(function () {                    
                var 
caracteristicas "height=300,width=200,scrollTo,resizable=1,scrollbars=1,location=0";  
                   
nueva=window.open('AdjuntaDescripcionMasivo.php?seleccion=' + (datosch), " "'Popup'caracteristicas);
                
nueva2=window.open('uploadify/SaveDescriptionMasiva2.php?seleccion=' + (datosch), " "'Popup'caracteristicas);
                return 
false;  
                });                
            
            })            
        });    
})
</script> 
Despues recibo los datos desde SAVEDESCRIPTIONMASIVA2

Código PHP:
<?php
require_once '../classes/Detalle.class.php';
$detalle = new Detalle();
$fecha=date('Y-m-d H:i:s');
$arr1= array($_GET["seleccion"]);
foreach (
$arr1 as $id){
    
$partes explode(">"$id);
    
$option=$partes[0];
    
$description=$partes[1];
    
$opt_id=$partes[2];
    
$idioma=$partes[3];
    echo 
$option;
    echo 
"<br>";
    echo 
$description;
    echo 
"<br>";
    echo 
$opt_id;
    echo 
"<br>";
    echo 
$idioma;
    echo 
"<br>";

    
$targetFolder '/Descripciones/uploadify/descripciones/'.$idioma// Relative to the root        
    
$ruta=$targetFolder.'/'.$opt_id;
    
$datos=$detalle->ListarDescripciones($opt_id);
    list(
$row,$num)=$datos;
        if (
$num == 0){
            if (
$idioma == "ENGLISH"){
                
$rutaen=$ruta;
                
$rutage="";
                
$rutaes="";
                
$rutapo="";
                
$detalle->InsertDescripcion($opt_id,$rutaen,$rutage,$rutaes,$rutapo);    
            }
                else if (
$idioma == "ALEMAN"){
                    
$rutaen="";
                    
$rutage=$ruta;
                    
$rutaes="";
                    
$rutapo="";
                    
$detalle->InsertDescripcion($opt_id,$rutaen,$rutage,$rutaes,$rutapo);    
                }
                    else if (
$idioma == "ESPANOL"){
                        
$rutaen="";
                        
$rutage="";
                        
$rutaes=$ruta;
                        
$rutapo="";
                        
$detalle->InsertDescripcion($opt_id,$rutaen,$rutage,$rutaes,$rutapo);    
                    }
                        else if (
$idioma == "PORTUGUES"){
                        
$rutaen="";
                        
$rutage="";
                        
$rutaes="";
                        
$rutapo=$ruta;    
                        
$detalle->InsertDescripcion($opt_id,$rutaen,$rutage,$rutaes,$rutapo);    
                        }
                
        }
    
//    else{
//            if ($idioma == "ENGLISH"){
//                $detalle->UpdateDescripcionen($opt_id,$ruta);
//            }
//                else if ($idioma == "ALEMAN"){
//                    $detalle->UpdateDescripcionge($opt_id,$ruta);
//                }
//                    else if ($idioma == "ESPANOL"){
//                        $detalle->UpdateDescripciones($opt_id,$ruta);
//                    }
//                        else if ($idioma == "PORTUGUES"){
//                            $detalle->UpdateDescripcionpo($opt_id,$ruta);                                                 
//                        }
//        }
}//Fin Foreach

?>
PERO ACA EL PROBLEMA SOLO ME TOMA EL ULTIMO VALOR SELECCIONADO DESDE LOS CHECKBOX....
ME PODRIAN AYUDAR...PLEASE