Ver Mensaje Individual
  #9 (permalink)  
Antiguo 09/06/2011, 00:43
InKarC
 
Fecha de Ingreso: noviembre-2005
Mensajes: 426
Antigüedad: 18 años, 5 meses
Puntos: 87
Respuesta: asignar campos de textarea a inputs

Código PHP:
Ver original
  1. <?
  2. $texto = nl2br($HTTP_POST_VARS[lineas]);
  3. $lineas = explode  ( '<br />'  , $texto );
  4.  
  5. foreach ($lineas as $k => $v) {
  6.  
  7.             echo "<SCRIPT> document.form.lineax.value=\"".$v."\";                    </SCRIPT>";
  8.  
  9.  
  10.          
  11. }  
  12. ?>

Esto esta generando <script> dinamicamente, asi que ES javascript.

------------------------------

Hecho en solo php...

Código HTML:
Ver original
  1. <?php $lineas = explode  ( '<br />'  , $texto ); ?>
  2.  
  3.  
  4. <p>
  5.   <label for="1"></label>
  6.   <input type="text" name="a" id="a" value="<?php echo $lineas[0] ?>" />
  7. </p>
  8. <p>
  9.   <input type="text" name="b" id="b" value="<?php echo $lineas[1] ?>" />
  10. </p>
  11. <p>
  12.   <input type="text" name="c" id="c" value="<?php echo $lineas[2] ?>" />
  13. </p>
  14. <p>
  15.   <input type="text" name="d" id="d" value="<?php echo $lineas[3] ?>" />
  16. </p>
  17. <p>
  18.   <input type="submit" name="ok" id="ok" value="Enviar" />
  19. </p>