Ver Mensaje Individual
  #2 (permalink)  
Antiguo 29/04/2012, 22:40
Avatar de chwc
chwc
 
Fecha de Ingreso: julio-2008
Ubicación: Buenos Aires ! :D
Mensajes: 814
Antigüedad: 15 años, 9 meses
Puntos: 103
Respuesta: Como añadir campo y capturarlo con post

Código HTML:
Ver original
  1. <html xmlns="http://www.w3.org/1999/xhtml">
  2. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  3. <title>Jquery Agregar campos</title>
  4. <script type="text/javascript" src="jquery-1.6.4.min.js"></script>
  5. <link href="style.css" rel="stylesheet" type="text/css" />
  6.  
  7. <script type="text/javascript">
  8. emails=0;
  9. function agregar() {
  10.     emails=emails+1;
  11.     $("#campos").append('<li class="email'+emails+'"> <input type="text" name="email['+emails+']" size="25" /> &nbsp;&nbsp;<a href="#" onclick="javascript:borrar('+emails+');">Borrar</a> </li>');
  12. }
  13. function borrar(cual) {
  14.     $("li.email"+cual).remove();
  15.     return false;
  16. }
  17. </script>
  18. </head>
  19.  
  20.     <form name="frm_multiple" method="post" action="procesar.php">
  21.     <ul id="emails">
  22.         <li>
  23.         <input type="text" size="20" name="email[0]" /><a href="javascript:agregar();">Agregar</a>
  24.         </li>
  25.         <li id="campos"><!-- aqui se crean los CAMPOS --></li>
  26.     </ul>
  27.    
  28.     <p align="center"><input type="submit" name="Send" value="Send" /></p>
  29.     </form>
  30.  
  31. </body>
  32. </html>
fijate asi