Ver Mensaje Individual
  #6 (permalink)  
Antiguo 25/03/2013, 08:27
Avatar de tquezada
tquezada
 
Fecha de Ingreso: febrero-2013
Ubicación: Santiago
Mensajes: 196
Antigüedad: 11 años, 2 meses
Puntos: 8
Respuesta: guardar checkbox al recargar un formulario

ok disculpen ahi esta el codigo
Código PHP:
Ver original
  1. <?
  2.  
  3. ?>
  4. <link href="../../css/cssnew.css" rel="stylesheet" type="text/css" />
  5. <style type="text/css">
  6. <!--
  7. body {
  8.     margin-left: 5px;
  9. }
  10. .Estilo2 {color: #999999}
  11. -->
  12. </style>
  13. <?
  14. include("../../inc/oConn.php");
  15.  
  16. $contador=1;
  17. if($_SESSION['rut']=="")
  18. {
  19.    echo "<p class=titulos>Para contestar la encuesta debe estar identificado en intranet.</p>";
  20.    exit();
  21. }
  22.  
  23. $strV="select * from encuesta_respuestas where rut_emp=".$_SESSION['rut']." and id_encuesta=$encuesta";
  24. $rsconn=$db->Execute($strV);
  25. if(!$rsconn->EOF)
  26. {
  27.   echo "<p class=titulos>Usted ya ha contestado la encuesta.</p>";
  28.   exit();
  29.  
  30. }
  31.  
  32. $strSQL="select * from encuestas_cabecera where id_encuesta=".$encuesta;
  33. $rsconn=$db->Execute($strSQL);
  34. if($rsconn->EOF)
  35. {
  36.   echo "La encuesta no existe o fue desactivada";
  37.   exit();
  38. }
  39. ?>
  40. <form action="graba_encuesta.php" method="POST" name="frmencuesta">
  41. <table width="695" border="0" cellspacing="0" cellpadding="0" class="txt8pt">
  42.   <tr>
  43.     <td align="center"><br /><p class="txt9pt"><b><? echo $rsconn->fields[1];?></b>
  44.       <input name="encuesta" type="hidden" id="encuesta" value="<? echo $encuesta;?>" />
  45.       <input name="rut" type="hidden" id="rut" value="<? echo $_SESSION['rut'];?>" />
  46.     </p>
  47.     <p  align="left"class="txt8pt"><? echo $rsconn->fields[2];?></p></td>
  48.   </tr>
  49.  
  50. <?
  51.     $seccion="";
  52.     $titulo="";
  53.     $strSQL="select a.ID_SEC,a.TITULO_SEC,a.DESC_SEC, ";
  54.     $strSQL.="b.ID_TITULO,b.NOMBRE_TITULO, ";
  55.     $strSQL.="c.ID_PREGUNTA,c.ID_PREGUNTA,c.ID_TIPO_RESP,c.ID_OPCION,C.PREGUNTA ";
  56.     $strSQL.="from encuesta_secciones a, encuesta_titulos b, encuesta_preguntas c ";
  57.     $strSQL.="where a.ID_SEC=b.ID_SEC ";
  58.     $strSQL.="and b.ID_TITULO=c.ID_TITULO ";
  59.     $strSQL.="and a.id_encuesta=".$encuesta;   
  60.     $strSQL.=" order by id_sec,id_titulo";
  61.     $rsconn=$db->Execute($strSQL);
  62.     while(!$rsconn->EOF)
  63.     {
  64.         //muestro el titulo de la seccion
  65.       if($seccion!=$rsconn->fields[0])
  66.       {
  67.           echo " <tr><td>&nbsp;</td></tr>";
  68.           echo  "<tr ><td bgcolor='E6E6E6'><p class=txt8pt><b>".$rsconn->fields[1]."</b></p></tr></td>";       
  69.           echo  "<tr ><td><p class=txt8pt><BR>".$rsconn->fields[2]."</p><br></tr></td>";                 
  70.           echo " <tr><td>&nbsp;</td></tr>";      
  71.           $contador=1;
  72.       }  
  73.       $seccion=$rsconn->fields[0];
  74.       // fin titulo seccion
  75.      
  76.      
  77.       //Muestro el titulo de las preguntas
  78.       if($rsconn->fields[4]!="ST" && $titulo!=$rsconn->fields[3])
  79.       {
  80.           echo  "<tr ><td class='txt8pt'><br><p class='txt8pt'>&nbsp; &nbsp;<b>".$rsconn->fields[4]."</p></tr></td>";      
  81.       }
  82.       $titulo=$rsconn->fields[3];
  83.       //FIN TITULO
  84.      
  85.  
  86.     //MUESTRO PREGUNTA
  87.     //rescarto el tipo de opciones que tiene la pregunta
  88.       $strOP="select TIPO_resp,CODIGO_RESP from ENCUENSTA_TIPO_RESP where id_tipo_resp=".$rsconn->fields[7];
  89.       $rsconn2=$db->Execute($strOP) or die ("No existe el tipo de resp");
  90.       if(!$rsconn2->EOF)
  91.       {
  92.  
  93.          if($rsconn2->fields[0]=="TEXT")
  94.          {
  95. ?>   
  96.           <tr><td>
  97.             <table width="692" border="1" cellpadding="1" cellspacing="0" bordercolor="E6E6E6" class="txt8pt">
  98.               <tr>
  99.             <td width="55" class="txt8pt Estilo2"><? echo $contador;//echo $rsconn->fields[5];?></td>
  100.             <td width="627">
  101. <?         
  102.             echo "&nbsp; &nbsp;".$rsconn->fields[9]."";
  103.             echo "<p align=center><input name='preg".$rsconn->fields[5]."' type='text' size='80' maxlength='80' class=TextoCam></p>";
  104. ?>        </td>
  105.             </tr></table>
  106. <?         
  107.          }elseif($rsconn2->fields[0]=="TEXTAREA"){
  108. ?>   
  109.           <tr><td>
  110.             <table width="692" border="1" cellpadding="1" cellspacing="0" bordercolor="E6E6E6" class="txt8pt">
  111.               <tr>
  112.             <td width="55" class="txt8pt Estilo2"><? echo $contador;//echo $rsconn->fields[5];?></td>
  113.             <td width="627">
  114. <?         
  115.             echo "&nbsp; &nbsp;".$rsconn->fields[9]."";
  116.             echo "<p align=center><textarea name='preg".$rsconn->fields[5]."' cols='80' rows='4' class=TextoCam>.</textarea></p>";
  117. ?>        </td>
  118.             </tr></table>
  119. <?         
  120.          }elseif($rsconn2->fields[0]=="RADIO"){
  121.          
  122.             $strOP2="select * from encuesta_Desc_opciones where id_opcion=".$rsconn->fields[8]." order by id_des_op";
  123.             $rsconn3=$db->Execute($strOP2) or die ("ERROR !");
  124. ?>
  125. <tr><td>
  126.             <table width="695" border="1" cellpadding="1" cellspacing="0" bordercolor="E6E6E6">
  127.            <tr>
  128.            <td width="37" class="txt8pt Estilo2"><? echo $contador;//echo $rsconn->fields[5];?></td>
  129.            <td width="453"  class="txt8pt">&nbsp; &nbsp;<? echo $rsconn->fields[9];?>:</td>
  130.          <td width="191" colspan="2"><table width="100%"><tr>
  131. <?         
  132.             while(!$rsconn3->EOF)
  133.             {
  134.               echo "<td class=txt8pt><input name='preg".$rsconn->fields[5]."' type='radio' value='".$rsconn3->fields[2]."' />".$rsconn3->fields[2]."</td>";
  135.               $rsconn3->Movenext();
  136.             }
  137. ?>
  138.       </tr></table>
  139.       </td>
  140.      
  141.       </table>
  142. </td></tr>   
  143. <?         
  144.          }elseif($rsconn2->fields[0]=="LISTA"){
  145.             $strOP2="select * from encuesta_Desc_opciones where id_opcion=".$rsconn->fields[8]." order by id_des_op";
  146.             $rsconn3=$db->Execute($strOP2) or die ("ERROR !"); 
  147. ?>      <tr><td>
  148.             <table width="695" border="1" cellpadding="1" cellspacing="0" bordercolor="E6E6E6">
  149.            <tr>
  150.            <td width="37" class="txt8pt Estilo2"><? echo $contador;//echo $rsconn->fields[5];?></td>
  151.            <td width='416' class="txt8pt">&nbsp; &nbsp;<? echo $rsconn->fields[9];?></td>
  152.            <td>
  153.  
  154. <?         
  155.             echo "<select name='preg".$rsconn->fields[5]."' class=TextoCam>";
  156.             echo "<option value=''>Seleccione..</option> ";
  157.             while(!$rsconn3->EOF)
  158.             {
  159.                echo "<option value='".$rsconn3->fields[2]."'>".$rsconn3->fields[2]."</option>";
  160.               $rsconn3->Movenext();
  161.             }          
  162.             echo "</select>";    
  163. ?>  
  164.    
  165.       </tr></table>
  166.     </td></tr> 
  167. <? 
  168.            
  169.          }else{
  170.          //fin
  171.          }
  172.       }
  173.  
  174.         $contador++;
  175.        $rsconn->Movenext();
  176.     }
  177.     $db->Close();
  178. ?> 
  179.   <tr>
  180.     <td align="center">
  181.       <label>
  182.       <input type="submit" name="Submit" value="Enviar Informaci&oacute;n"  class="TextoCam"/>
  183.       </label></td>
  184.   </tr>
  185. </table>
  186. <br />
  187. </form>

espeo me ayuden
__________________
¿Sabes cuántos programadores hacen falta para cambiar una bombilla? - no, no ¿Cuántos? - Ninguno... es un problema de hardware.