Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/12/2015, 20:16
fcosun
 
Fecha de Ingreso: octubre-2011
Mensajes: 153
Antigüedad: 12 años, 5 meses
Puntos: 7
cargar un arreglo dinamicamente

capturo los datos en un input la idea es cargar un arreglo con los datos ingresados, tengo este codigo.


Código PHP:
Ver original
  1. <!doctype html>
  2. <html lang="es">
  3. <head>
  4.   <meta charset="utf-8">
  5.   <title>PHP</title>
  6.   <style>
  7.  
  8.   </style>
  9.   <script src=""></script>
  10. </head>
  11. <body>
  12.  
  13.  <form action="arreglo.php" method="post">
  14.     Nombre <input type="text" value="" id="nombre" name="nombre" />
  15.     <br />
  16.     Edad: <input type="text" value="" id="edad" name="edad" />
  17.     <br />
  18.     Email: <input type="text" value="" id="email" name="email" />
  19.     <br />
  20.     <input type="submit" value="enviar" id="enviar"/>
  21.  </form>
  22.  
  23. <script>
  24. </script>
  25. </body>
  26. </html>
  27.  
  28. <?php
  29.  
  30. $datos=array($_REQUEST['nombre'],$_REQUEST['edad'],$_REQUEST['email']);
  31. $cant=count($datos);
  32.  
  33. echo "$cant<br><br>";
  34.  
  35. for($x=0;$x<$cant;$x++)
  36.   {
  37.       echo $datos[$x];
  38.       echo "<br>";
  39.   }
  40. ?>
__________________
Mi mail: [email protected]

Última edición por fcosun; 07/12/2015 a las 20:24