Ver Mensaje Individual
  #12 (permalink)  
Antiguo 19/10/2009, 09:24
Avatar de gjx2
gjx2
 
Fecha de Ingreso: agosto-2008
Ubicación: R.D
Mensajes: 1.153
Antigüedad: 15 años, 8 meses
Puntos: 139
Respuesta: Ayuda con array por favor

No se si te refieres hacer algo parecido a esto

Código CODIGO:
Ver original
  1. <?php
  2.  
  3.     if(isset($_POST['btn']) && !empty($_POST['text'])){
  4.     echo "<table border=1><tr>";
  5.    
  6.         foreach($_POST['text'] as $row => $field){
  7.        
  8.         echo "<b>".$row."</b><br>";
  9.        
  10.                 for($a=0;$a<count($_POST['text']);$a++){
  11.                
  12.                         echo $_POST['text'][$a]."<br>";
  13.            
  14.                 }
  15.            
  16.        
  17.         }
  18.        
  19.        
  20.     }
  21.  
  22. ?>
  23.  
  24. <script>
  25.  
  26.  
  27. function mk(){
  28.  
  29. var f = document.getElementById("Formulario");
  30. var cantidad = document.getElementById("Cant").value;
  31. for(a=0;a<parseInt(cantidad);a++){
  32.  
  33.    
  34. var input=document.createElement('input');
  35. input.setAttribute('type','text');
  36. input.setAttribute('name','text[]');
  37. input.setAttribute('value',a);
  38. f.appendChild(input);
  39.     }
  40.  
  41. }
  42.  
  43. </script>
  44.  
  45.  
  46. <form name="Formulario" id="Formulario" method="post">
  47. <input type="button" onClick="mk()" value="Crear input">
  48. <div>Cantidad Input<input type="text" name="Cant" id="Cant">
  49. <input type="submit" name="btn" value="Enviar">
  50. </div>
  51.  
  52. </form>