Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/02/2008, 11:23
alexisfch
 
Fecha de Ingreso: septiembre-2007
Mensajes: 150
Antigüedad: 16 años, 7 meses
Puntos: 1
Exclamación Importar datos desde *.txt a Formulario.

Hola, tengo un formulario que al enviarse escribe un *.txt con los datos del form.
los escribe separados por TAB (\t) a fin importarlo a excel.
y cuando escribe crea cada vez un archivo nuevo llamado $rut.txt

COMO PUEDO HACER PARA RECOGER O IMPORTAR LOS DATOS DE UN $rut.txt EN ESTE MISMO FORMULARIO, A FIN DE HACERLE MODIFICACIONES Y VOLVER A GUARDARLO BAJO EL MISMO NOMBRE.

formulario.php
Código PHP:
<form name="frm" action="motor.php" method="post">
  
RUT
<input type="text" name="rut" id="rut"/>
<
br />
nombre
<input type="text" name="nombre" id="nombre"/>
<
br />
apellido
<input type="text" name="apellido" id="apellido"/>
<
br />
direccion
<input type="text" name="direccion" id="direccion"/>
<
br />
comuna
<input type="text" name="comuna" id="comuna"/>
<
br />
pais
<input type="text" name="pais" id="pais"/>
<
br />
telefono
<input type="text" name="telefono" id="telefono"/>
<
br />
<
input name="enviar" type="submit" id="enviar" value="enviar" />
<
br />
</
form>
</
div
motor.php
Código PHP:
<?php
$fp 
fopen("$rut.txt","w");
fwrite($fp"$nombre\t$apellido\t$direccion
$comuna\t$pais\t$telefono\r\n
"
);

fclose($fp);
?>
Gracias