Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/09/2010, 06:49
eke_ps
 
Fecha de Ingreso: septiembre-2010
Mensajes: 101
Antigüedad: 13 años, 8 meses
Puntos: 0
Respuesta: ayuda con error al modificar opciones

Código HTML:
Ver original
  1. <script type="text/javascript">
  2. <!--
  3. function MM_validateForm() { //v4.0
  4.  if (document.getElementById){
  5.    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  6.    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
  7.      if (val) { nm=val.name; if ((val=val.value)!="") {
  8.        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
  9.          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
  10.        } else if (test!='R') { num = parseFloat(val);
  11.          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
  12.          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
  13.            min=test.substring(8,p); max=test.substring(p+1);
  14.            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
  15.      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  16.    } if (errors) alert('The following error(s) occurred:\n'+errors);
  17.    document.MM_returnValue = (errors == '');
  18. } }
  19. //-->
  20.  
  21.  
  22.  
  23. </head>
  24. <?php include("includes/top.php")?>
  25. <?php include("includes/menu.php")?>
  26.  
  27. <div id="separador"></div>
  28. <div id="separador"></div>
  29.  
  30.  
  31. <h1>Administración de Encuestas</h1>
  32. <table width="600" border="0" align="center">
  33. <tr>
  34.     <td>Borrar</td>
  35.     <td>Modificar</td>
  36.     <td>Pregunta</td>
  37.     <td>Fecha</td>
  38.     <td>Status</td>
  39.     <td>Ver</td>
  40.  
  41. </tr>
  42. <?php
  43. while($var = mysql_fetch_array($miencuesta)){
  44. ?>
  45. <tr>
  46.     <td colspan="6" height="1" bgcolor="#000000"> </td>  
  47.   </tr>
  48. <tr>
  49. <td><a href="#" onClick="validarborrar(<?php echo($var['id'])?>)"><img src="images/borrar.gif" width="11" height="15" border="0" /></a></td>
  50.  
  51. <td><a href="adminencuesta.php?m=1&id=<?php echo($var['id'])?>"><img src="images/editar.gif" width="14" height="18" border="0" /></a></td>
  52.  
  53.  
  54.     <td><?php echo($var['pregunta']);?></td>
  55.     <td><?php echo($var['fecha']);?></td>
  56.     <td>
  57.    
  58.    
  59.     <?php if($var['status']==0){?>
  60.         <a href="adminencuesta.php?mstatus=<?php echo($var['id'])?>&status=1"><img src="images/cerrar.gif" width="9" height="10" border="0"  /></a>
  61.    <?php }else{ ?>
  62.    
  63.    <a href="adminencuesta.php?mstatus=<?php echo ($var['id'])?>&status=0"> <img src="images/check.gif" width="12" height="14" border="0" />
  64.    <?php } ?>
  65.    </td>
  66.    
  67.  
  68.    
  69.    
  70.  <td><a href="adminencuesta.php?v=<?php echo($var['id'])?>"><img src="images/eye-icon.png" width="24" height="13" border="0" /></a></td>  
  71.    
  72. </tr>
  73.  
  74. <?php } ?>
  75. <script>
  76. function validarborrar(id){
  77.     if(confirm("¿Esta seguro que desea borrar?")){
  78.         window.location="adminencuesta.php?b="+id;
  79.     }  
  80. }
  81.  
  82.  
  83. <?php if(isset($_GET['v'])){
  84.     $mostrar=mysql_query("SELECT * FROM tbl_encuestasp where id=".$_GET['v']);
  85.      $veropciones=mysql_query("SELECT idpregunta,respuesta FROM tbl_encuestasr WHERE idpregunta=".$_GET['v']);
  86. ?>
  87.  
  88.  
  89. <div id="separador"></div>
  90. <table width="316" height="159" align="center">
  91. <?php while($dg=mysql_fetch_assoc($mostrar)){?>
  92.    
  93.     <tr>
  94.       <td width="58">Pregunta:</td>
  95.       <td width="10">&nbsp;</td>
  96.       <td width="607" height="28"><?php echo($dg['pregunta'])?></td></tr>
  97.     <?php $ver=mysql_fetch_assoc($veropciones);?>
  98.     <tr>
  99.     <tr>
  100.       <td bgcolor="#000000"></td>
  101.       <td bgcolor="#000000"></td>
  102.     <td height="1" bgcolor="#000000"></td></tr>
  103.       <tr>
  104.         <td width="58">Opcion 1:</td>
  105.         <td width="10">&nbsp;</td>
  106.       <td width="607"><?php echo($ver['respuesta']);?></td></tr>
  107.     <?php $ver=mysql_fetch_assoc($veropciones);?>
  108.     <tr>
  109.     <tr>
  110.       <td bgcolor="#000000"></td>
  111.       <td bgcolor="#000000"></td>
  112.     <td height="1" bgcolor="#000000"></td></tr>
  113.       <tr>
  114.         <td width="58">Opcion 2:</td>
  115.         <td width="10">&nbsp;</td>
  116.       <td width="607"><?php echo($ver['respuesta']);?></td></tr>
  117.     <?php $ver=mysql_fetch_assoc($veropciones);?>
  118.     <tr>
  119.     <tr>
  120.       <td bgcolor="#000000"></td>
  121.       <td bgcolor="#000000"></td>
  122.     <td height="1" bgcolor="#000000"></td></tr>
  123.       <tr>
  124.         <td width="58">Opcion 3:</td>
  125.         <td width="10">&nbsp;</td>
  126.       <td width="607"><?php echo($ver['respuesta']);?></td></tr>
  127.      <?php $ver=mysql_fetch_assoc($veropciones);?>
  128.     <tr>
  129.     <tr>
  130.       <td bgcolor="#000000"></td>
  131.       <td bgcolor="#000000"></td>
  132.     <td height="1" bgcolor="#000000"></td></tr>
  133.       <tr>
  134.         <td width="58">Opcion 4: </td>
  135.         <td width="10">&nbsp;</td>
  136.       <td width="607"><?php echo($ver['respuesta']);?></td></tr>
  137.  
  138.  
  139.  <?php  }?>
  140.  <?php  }?>
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158. <div id="separador"></div>
  159. <table align="center" >
  160. <tr>
  161. <td><a href="adminencuesta.php?a=1" >Realizar nueva encuesta</a></td>
  162. </tr>
  163. <div id="separador"></div>
  164.  
  165. <?php if(isset($_GET['a'])){?>
  166.  
  167. <form  action="adminencuesta.php"method="POST"  >
  168.   <table width="268" border="0" align="center">
  169.        
  170.         <tr>
  171.         <td width="144" height="56">Escribe tu pregunta: <input  name="pregunta" type="text" id="pregunta" size="40"  maxlength="51" align="left" /><br /></td>
  172.         </tr>
  173.         <tr><td height="1" bgcolor="#000000"></td></tr>
  174.         <tr>
  175.         <td height="42">opcion 1:  <input name="opcion1" type="text" id="opcion1"size="30"    maxlength="28" />
  176.           <input type="hidden" name="hiddenField" id="hiddenField" /></td>
  177.         </tr>
  178.          <tr><td height="1" bgcolor="#000000"></td></tr>
  179.         <tr>
  180.         <td height="44">opcion 2:  <input name="opcion2" type="text" id="opcion2"size="30"  maxlength="28"/>
  181.           <input type="hidden" name="hiddenField2" id="hiddenField2" /></td>
  182.         </tr>
  183.         <tr><td height="1" bgcolor="#000000"></td></tr>
  184.         <tr>
  185.         <td height="51">opcion 3:  <input type="text"  name="opcion3" id="opcion3"size="30"   maxlength="28"/>
  186.           <input type="hidden" name="hiddenField3" id="hiddenField3" /></td>
  187.         </tr>
  188.          <tr><td height="1" bgcolor="#000000"></td></tr>
  189.         <tr>
  190.         <td height="46">opcion 4:  <input type="text" name="opcion4" id="opcion4" size="30" maxlength="28"/>
  191.           <input type="hidden" name="hiddenField4" id="hiddenField4" /></td>
  192.         </tr>
  193.         </table>
  194.   <input name="agregar" type="submit" onClick="MM_validateForm('pregunta','','R','opcion1','','R','opcion2','','R');return document.MM_returnValue" value="Crear"  />
  195.  
  196. </form>
  197.    
  198. <p>
  199.   <?php }?>
  200.    
  201. </p>
  202.  
  203.  
  204.  
  205. <?php if(isset($_GET['m'])){
  206.        $modificar=mysql_fetch_array(mysql_query("SELECT id,pregunta  FROM tbl_encuestasp WHERE id=".$_GET['id']));
  207.        $modificaropciones=mysql_query("SELECT id,idpregunta,respuesta FROM tbl_encuestasr WHERE idpregunta=".$_GET['id']);
  208.        ?>
  209.  
  210. <form id="Modificar" name="form1"  method="POST" action="adminencuesta.php">
  211. <input type="hidden" name="id" value="<?php echo $_GET['id']; ?>">
  212.  
  213.  
  214. <table align="center" border="0">
  215.   <tr>
  216.     <td height="48"width="342">Modifica la pregunta:
  217.    
  218.       <input  name="pregunta" type="text" id="pregunta" value="<?php echo($modificar['pregunta']);?>"  size="40"  maxlength="51" align="left" />
  219.      
  220.       <br /></td>
  221.   </tr>
  222.    
  223.    <tr><td height="1" bgcolor="#000000"></td></tr>
  224.   <tr>
  225.     <td height="42">Modifica la opcion 1:
  226.    
  227.     <?php $data=mysql_fetch_assoc($modificaropciones);?>
  228.    
  229.     <input name="modopcion1" type="text" id="modopcion1" value="<?php echo($data['respuesta']);?>" size="30"    maxlength="28" />
  230.  
  231.  
  232.    
  233.    
  234.   </tr>
  235.    <tr><td height="1" bgcolor="#000000"></td></tr>
  236.   <tr>
  237.     <td height="42">Modifica la opcion 2:
  238.        <?php $data=mysql_fetch_assoc($modificaropciones);?>
  239.       <input name="modopcion2" type="text" id="modopcion2" value="<?php echo($data['respuesta']);?>" size="30"  maxlength="28"/></td>
  240.   </tr>
  241.    <tr><td height="1" bgcolor="#000000"></td></tr>
  242.   <tr>  
  243.     <td height="42">Modifica la opcion 3:
  244.       <?php $data=mysql_fetch_assoc($modificaropciones);?>
  245.       <input type="text" id="modopcion3"  name="modopcion3"size="30" value="<?php echo($data['respuesta']);?>"   maxlength="28"/></td>
  246.   </tr>
  247.    <tr><td height="1" bgcolor="#000000"></td></tr>
  248.   <tr>
  249.     <td height="42">Modifica la opcion 4:
  250.        
  251.        <?php $data=mysql_fetch_assoc($modificaropciones);?>
  252.       <input type="text" id="modopcion4" name="modopcion4" value="<?php echo($data['respuesta']);?>" size="30" maxlength="28"/></td>
  253.  
  254.   </tr>
  255. <input name="modificar" type="submit" id="modificar"value="modificar" onClick="MM_validateForm('pregunta','','R','opcion1','','R','opcion2','','R');return document.MM_returnValue"   />
  256. </form>
  257. <p>&nbsp;</p>
  258.  
  259. <?php }?>
  260. <?php include("includes/botton.php")?>
  261. </body>
  262. </html>