Ver Mensaje Individual
  #3 (permalink)  
Antiguo 11/07/2011, 09:22
Avatar de Marvin
Marvin
Colaborador
 
Fecha de Ingreso: febrero-2005
Ubicación: global $Chile->Santiago;
Mensajes: 1.991
Antigüedad: 19 años, 3 meses
Puntos: 81
Respuesta: Seleccionar checkbox de base de datos mysql

Haz intentado pasar todo a php?

Código php:
Ver original
  1. $uno    = (in_array(1, $array)?'checked="checked"':'');
  2. $dos    = (in_array(2, $array)?'checked="checked"':'');
  3. $tres   = (in_array(3, $array)?'checked="checked"':'');
  4. $cuatro = (in_array(4, $array)?'checked="checked"':'');
  5.  
  6. $html = '
  7. <html>
  8. <body>
  9.     <form>
  10.         <table width="250" border="0" cellspacing="0" cellpadding="0">
  11.         <tr>
  12.             <td colspan="2">Checks seleccionados hasta ahora: </td>
  13.         </tr>
  14.         <tr>
  15.             <td>Uno</td>
  16.             <td><input type="checkbox" name="1" value="1" '.$uno.' /></td>
  17.         </tr>
  18.         <tr>
  19.             <td>Dos</td>
  20.             <td><input type="checkbox" name="2" value="2" '.$dos.' /></td>
  21.         </tr>
  22.         <tr>
  23.             <td>Tres</td>
  24.             <td><input type="checkbox" name="3" value="3" '.$tres.' /></td>
  25.         </tr>
  26.         <tr>
  27.             <td>Cuatro</td>
  28.             <td><input type="checkbox" name="4" value="4" '.$cuatro.' /></td>
  29.         </tr>
  30.         </table>
  31.     <form>
  32. </body>
  33. </html>';
  34. print $html;

Suerte!
__________________
El que dice "Solo sé que nada sé", esta asumiendo que sabe algo.
Lea las FAQ's!