Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/01/2014, 16:45
Avatar de satjaen
satjaen
 
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 8 meses
Puntos: 10
Hacer update de dos checkbox.

Hola, por favor me gustaría saber como puedo hacer el update de dos checkbox. Ahora cuando lo hago me borra los datos que anteriormente había ingresado.

index.php

Código Javascript:
Ver original
  1. if ((isset($_POST["id_aviso"]) &&isset($_POST["MM_update"]) == "form1")) {
  2.   $updateSQL = sprintf("UPDATE avisos SET urg=%s, rec=%s WHERE id_aviso='".$_POST['id_aviso']."'",
  3.  
  4.                      
  5.                      
  6.                        GetSQLValueString($_POST['urg'], "text"),
  7.                        GetSQLValueString($_POST['rec'], "text"));
  8.                  
  9.  
  10.   mysql_select_db($database_conexion, $conexion);
  11.   $Result1 = mysql_query($updateSQL, $conexion) or die(mysql_error());
  12. }
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19. <form method="POST" name="form1" id="form1" action="<?php echo $editFormAction; ?>">
  20. <table width="100%">
  21.   <tr>
  22.  
  23.     <td width="50%">Reclamado
  24.         <input <?php
  25.  
  26.   define('CADENA_DIFERENCIADORA', '  checked="checked"  ');
  27.  
  28.  
  29.   if ($row_usuarios['rec'] == 'RECLAMACION') echo CADENA_DIFERENCIADORA ; // OK!
  30. ?> type="checkbox" name="rec"/>
  31.         </td>
  32.              
  33.   <td width="50%">Urgente
  34.  
  35.          <input <?php
  36.  
  37.   define('CADENA_DIFERENCIADORA', '  checked="checked"  ');
  38.  
  39.  
  40.   if ($row_usuarios['urg'] == 'on') echo CADENA_DIFERENCIADORA ; // OK!
  41. ?> type="checkbox" name="urg"/>
  42.         </td>
  43.        
  44.   </tr>
  45.  
  46.  </table>
  47.   <input type="hidden" name="MM_update" value="form1" />
  48.   <input type="hidden" name="id_aviso" value="<?php echo $row_usuarios['id_aviso']; ?>" />
  49. </form>


Muchas gracias

Última edición por satjaen; 26/01/2014 a las 17:00