Ver Mensaje Individual
  #2 (permalink)  
Antiguo 28/08/2013, 13:56
bathorz
 
Fecha de Ingreso: agosto-2013
Mensajes: 150
Antigüedad: 10 años, 8 meses
Puntos: 29
Respuesta: formulario con checkbox

input type='date' de html5 aún no funciona bien en todos los navegadores, en Opera ok.
Código PHP:
Ver original
  1. <style type="text/css">
  2. table {
  3.     border: 1px solid #000; padding: 2px;
  4.     font: 10px; width: 433px; height: 48px;
  5. }
  6. td {border: 1px solid #999;}
  7. input {font: 10px;}
  8. </style>
  9.  
  10. <?php
  11. // nombre
  12. $nomb = array('n0','n1','n2','n3','n4','n5','n6','n7','n8','n9');
  13. // ministerio
  14. $min = array('m0','m1','m2','m3','m4','m5','m6','m7','m8','m9');
  15. //...
  16. $rs = array(1,2,3,4,5,6,7,8,9,10);
  17.  
  18. ?>
  19. <form action="" name="form" method="post">
  20.     <table>
  21.         <tr>
  22.             <th scope="col">
  23.                 <!--  -->
  24.                 <table>
  25.                     <thead>
  26.                         <tr>
  27.                             <th width="172">NOMBRE</th>
  28.                             <th width="101">MINISTERIO</th>
  29.                             <th width="20">DV</th>
  30.                             <th width="20">C.O</th>
  31.                             <th width="20">C.E</th>
  32.                             <th width="20">C.A</th>
  33.                             <th width="20">ALB</th>
  34.                             <th width="24">VIG</th>
  35.                    
  36.                     </thead>
  37.                     <tbody>
  38.                         <?php
  39.                         //while( $row = odbc_fetch_array($rs) ) {
  40.                         for ($i = 0; $i < count($rs); $i++) {
  41.  
  42.                            echo '<tr>';
  43.                            //$nomb=$row['VC_NOMBRE1'];
  44.                            //$min=$row['VC_DESC_MINISTERIO'];
  45.  
  46.                            echo"
  47.                            <td><input id='nombres' type='text' name='nombr[$i]' size=37 value='$nomb[$i]'readonly></td>
  48.                            <td><input id='min' type='text' name='min[$i]' value='$min[$i]' readonly></input></td>";
  49.                            /** ckeckbox **///DV C.O C.E C.A ALB VIG
  50.                            echo "
  51.                            <td><input type='checkbox' name='fila1[dv][$i]' value=1></td>
  52.                            <td><input type='checkbox' name='fila1[co][$i]' value=2></td>
  53.                            <td><input type='checkbox' name='fila1[ce][$i]' value=3></td>
  54.                            <td><input type='checkbox' name='fila1[ca][$i]' value=4></td>
  55.                            <td><input type='checkbox' name='fila1[alb][$i]' value=5></td>
  56.                            <td><input type='checkbox' name='fila1[vig][$i]' value=6></td>";
  57.                            echo '</tr>';
  58.                         }
  59.                         ?>
  60.                     </tbody>
  61.                 </table>
  62.             </th>
  63.         </tr>
  64.     </table>
  65.     <div class="demo">
  66.         <!--  -->
  67.         Fecha:
  68.         <?php
  69.         // fija el select en una opción
  70.         if (isset($_POST['fecha'])) {
  71.            echo "<input type='date' name='fecha' size='8' maxlength='10' value='".$_POST['fecha']."' />";
  72.         } else {
  73.            echo "<input type='date' name='fecha' size='8' maxlength='10' value='".date('Y-m-d')."' />";
  74.         }
  75.         ?>
  76.         <!--  -->
  77.         <input type="submit" name="nuevafecha" value="Enviar" />
  78.     </div>
  79.  
  80. </form>
  81.  
  82. <?php
  83. if(isset($_POST['nuevafecha'])) {
  84.    echo $_POST['fecha'];
  85.    echo '<hr>';
  86.    print_r($_POST['nombr']);
  87.    echo '<hr>';
  88.    print_r($_POST['min']);
  89.    echo '<hr>';
  90.    print_r($_POST['fila1']);
  91. }
  92. ?>