Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/06/2013, 20:45
Avatar de RobCo
RobCo
 
Fecha de Ingreso: julio-2012
Mensajes: 50
Antigüedad: 11 años, 9 meses
Puntos: 1
Matriz escalar y asociativo

Es mi primera vez que uso matriz escalar y asociativa al mismo tiempo:

Bueno, tengo problema en ingresar datos 1 a 1 hasta llegar el limite. Mi problema es que cuando ingreso los datos en el input y en el radio me repite los mismo datos en lugar de ingresar los datos 1 por 1 hasta llegar su limite. Aquí les dejo mi código:

Código PHP:
Ver original
  1. <form method="POST" action="">
  2.    
  3.     Cedula:<input type="text" name="cedula" id="cedula" onFocus="">
  4.     <br>
  5.     <input type="radio" name="sexo" id="sexo" value="Hombre">Hombre
  6.     <br>
  7.     <input type="radio" name="sexo" id="sexo" value="Mujer">Mujer
  8.     <br>
  9.     <input type="submit" value="O.k">
  10. </form>
  11.  
  12. <?php
  13.  
  14.  
  15. for($f = 0; $f < 4; $f++)
  16. {
  17.     for($c = 0; $c < 4; $c++)
  18. {
  19.      
  20.          $M[$f][$c]['cedula'] = $_POST['cedula'];
  21.          $M[$f][$c]['sexo'] = $_POST['sexo'];
  22.        
  23.        
  24.      
  25.    }
  26. }
  27.    for($f = 0; $f < 4; $f++)
  28. {
  29.        for($c = 0; $c < 4; $c++)
  30. {
  31.      
  32.          echo "<table border='1'><tr><td>".$M[$f][$c]['cedula']."</td>
  33.             <td>".$M[$f][$c]['sexo']."</td></tr></table>";
  34.        
  35.      
  36.    }
  37. }
  38. ?>