Ver Mensaje Individual
  #9 (permalink)  
Antiguo 29/07/2008, 10:46
El_fenix
 
Fecha de Ingreso: junio-2006
Mensajes: 137
Antigüedad: 17 años, 11 meses
Puntos: 0
Respuesta: No se como capturar el id de un checkbox[]

Hola Un_Tico aca esta el codigo completo que utilizo

Formulario para enviar la informacion
Código PHP:
<?php
include("conx/conectar.php");
include(
"newsletter/fckeditor/fckeditor.php");

$url explode("?",$_SERVER['HTTP_REFERER']);
$redir=$url[0];

$link=Conectarse();
?>

<form name="form1" method="post" action="<?php print $redir'?id=' .$id?>">
<table width="460" border="0" cellspacing="0" cellpadding="0" align = "center" >
    <tr>
        <td colspan = '2'>
            <h2>Enviar Mensaje Personalizado</h2> 
        </td>
    </tr>
    <tr><td> Buscar Postulante por:</td>
        <td>
            <select name='buscar'>
                <option selected value='ninguno'>(Ninguno)</option>
                <option value='nombre'>Nombre</option>
                <option value='apellido'>Apellido</option>
            </select>
        </td>
    </tr>
    <tr><td>Ingresar filtro de busqueda</td>
        <td><input name='filtro' type='text' id='filtro' size='20' maxlength='15'></td>
    </tr>
    <tr>
        <td></td>
        <td><input name='enviar' type='submit' id='enviar' value='Buscar'></td>
    </tr>    
</table>
<br></br>
<hr>

<?php

    $buscar 
$_POST['buscar'];
    
$filtro $_POST['filtro'];

    if(
$buscar == 'nombre' || $buscar == 'apellido'){
            echo 
"<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0' >";
            echo 
"<tr align='left' bgcolor='#D5D5FF'>";
            
//echo "<td width='10%'></td>";
            
echo "<td width='50%'>Usuario Applicant</td>";
            echo 
"<td width='50%'>Nombre</td>";
            echo 
"</tr>";

        if(
$buscar == 'nombre'){
            
$sql mysql_query("select * from postulante where nombre ='".$filtro."'"$link);
            
/*$total=mysql_num_rows($sql);
            $paginas=intval($total/50)+1;
                
            if ($_GET["p"]==NULL)
                $_GET["p"]=1;
                    
            $inf=($_GET["p"]*50)-50;
            echo "<p align = 'center'>Seleccione al o a los Postulantes que desea que reciban este mensaje</p>";
            echo $inf." al ".($inf+50);

            $sql=mysql_query("select * from postulante LIMIT ".$inf.",50",$link);*/
        
}

        if(
$buscar == 'apellido'){
            
$sql=mysql_query("select * from postulante where paterno like '".$filtro."%' or materno like '".$filtro."%'",$link);

            
/*$total=mysql_num_rows($sql);
            $paginas=intval($total/50)+1;
                
            if ($_GET["p"]==NULL)
                $_GET["p"]=1;
                    
            $inf=($_GET["p"]*50)-50;
            echo $inf." al ".($inf+50);

            $sql=mysql_query("select * from postulante LIMIT ".$inf.",50",$link);*/
        
}

        while(
$row mysql_fetch_array($sql)){
                echo 
"<tr>";
                [
B]//echo "<td width='10%'><input type='checkbox' name='campos[".$row['usuario']."]'></td>";[/B]
                
echo "<td width='50%'>".$row["usuario"]."</td>";
                echo 
"<td width='50%'>".$row["nombre"]." ".$row["paterno"]." ".$row["materno"]."</td>";
                echo 
"</tr>";
                
$usuario $row['usuario'];
        }
        echo 
"</table>";
    }

    
$sql "select * from datos_postulante where usuario = '".$usuario."'";
    
$respuesta mysql_query($sql$link);

    while(
$row mysql_fetch_array($respuesta)){
        
$post_asunto $row['proceso_1_asunto'];
        
$post_info $row['proceso_1'];
        
$post_fecha $row['proceso_fecha_1'];
        
$spon_asunto $row['proceso_2_asunto'];
        
$spon_info $row['proceso_2'];
        
$spon_fecha $row['proceso_fecha_2'];
        
$visa_asunto $row['proceso_3_asunto'];
        
$visa_info $row['proceso_3'];
        
$visa_fecha $row['proceso_fecha_3'];
        
$emba_asunto $row['proceso_4_asunto'];
        
$emba_info $row['proceso_4'];
        
$emba_fecha $row['proceso_fecha_4'];
        
$aere_asunto $row['proceso_5_asunto'];
        
$aere_info $row['proceso_5'];
        
$aere_fecha $row['proceso_fecha_5'];
        
$aere_destino $row['destino'];
        
$fina_asunto $row['proceso_6_asunto'];
        
$fina_info $row['proceso_6'];
        
$fina_fecha $row['proceso_fecha_6'];
        
$deta_pagos $row['det_pagos'];
        
$dato_depositos $row['datos_dep'];
        
$otros $row['otros'];
    }

?>
<br />
<hr />
<input type="checkbox" name="otros" id = "otros" onClick="MosOcu('otros')"> <b>Publicar otra Informacion.</b><br />
<div id = 'capaotros'>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td><b>Otros Datos:</b></td>
    <td><textarea name='otros_info' id='otros_info' cols='65' rows='6'><?php echo $otros?></textarea></td>
    </tr>
    <tr>
    <td>
    </td>
    <td>    
    <input  type="button" id = "btn_ing_otros" value="Ingresar" onclick="valida_ingresa_otros()" />
    </td>
    </tr>
    </table>
    <input type = "hidden" id = "usuario" value = "<?php echo $usuario?>"/>
    <input type = "hidden" id = "grupo" value = "<?php echo $_GET['grp']; ?>"/>
</form>
</div>

Este es el codigo protoype para enviar otro tipo de info (solo publicare un modulo los otros son iguales, solo capturan distinta info)
Código:
/***********************************************************************************************
ENVIAR OPTRO TIPO DE INFORMACION
***********************************************************************************************/
valida_ingresa_otros = function() {	
	var error = 0;
	if($('otros_info').value == 0){
		alert("Debe completar Otros Datos");
		error++;
	}
	if(error == 0)ingresa_otros(); 
}

ingresa_otros = function() {
	var parametros = 'otros_info=' + $('otros_info').value;
	var pars = parametros + '&grupo=' + $('grupo').value + '&usuario=' + $('usuario').value;
	alert(pars);
	new Ajax.Request("informacion/ing_datos_otros.php", {method: 'post', parameters: pars, onComplete: ingresa_otros_respuesta});
}

ingresa_otros_respuesta = function(resp) {
	eval(resp.responseText);
	if(msg.error == 0){
		alert(msg.txt);
	}
	else alert(msg.txt);
}
Aca esta comentado el codigo parta enviar el input porque no supe como hacerlo asi que opte por otro metodo pero tampoco me resulta.

Ojala entiendas lo que hice

Chauz