Ver Mensaje Individual
  #2 (permalink)  
Antiguo 02/04/2016, 03:06
xerifandtomas
 
Fecha de Ingreso: octubre-2010
Ubicación: España
Mensajes: 1.007
Antigüedad: 13 años, 6 meses
Puntos: 123
Respuesta: Organizar matriz generada por teclado

Código PHP:
Ver original
  1. <?php  
  2.  
  3. if ($_POST['enviar']){
  4.     echo "<table border>";
  5.     for($i=0;$i<$_POST[filas];$i++){
  6.         echo "<tr>"; // el tr no lo cerramos hasta haber anidado los td
  7.             // dentro de la etiqueta tr no debe de haber nada que no sea un td
  8.            //<input type='text' name='filas'>  
  9.             //} el for tampoco lo cerramos
  10.              
  11.     for($j=0;$j<$_POST[columnas];$j++){            
  12.         echo "<td>".$i." - ".$j."<input type='text' name='columnas'></td>";
  13.     }
  14.  
  15.  
  16. //Cerramos aquí el primer for y el tr
  17. echo "</tr>";
  18. }
  19. echo "</table>";
  20.      
  21. }//cierra boton enviar
  22.  
  23. ?>

Última edición por xerifandtomas; 02/04/2016 a las 03:20