PHP - enviar datos de formulario a .txt

 
Vista:
sin imagen de perfil

enviar datos de formulario a .txt

Publicado por juan (1 intervención) el 17/07/2015 03:46:57
hola
llevo dias buscando , agredezco de antemano sus ayudas

tengo un formulario html y quiero pasar esos datos a un .txt
* desde firefox no pasa nada
* desde iexplorer abre el archivo php pero no guarda los registros

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//INSERTAR.HTML
<html>
<body>
<form action="TEXTO.PHP" method="POST" >
Field 1 <br />
<input type="text" size="100" name="field1" /><br />
Field 2 <br />
<input type="text" size="100" name="field2" /><br />
<input type="submit" value="Enviar" />
</form>
</body>
</html>
 
// TEXTO.PHP
<?php
$var1 = 'juan';
$var2 = '123456';
$archivo = fopen("datos114.txt","a+");
$cadena = "Nombre: ".$var1.".\r\nPass: ".$var2.".\r\n\r\n";
if(fputs($archivo,$cadena) == TRUE){echo "Se a creado con exito el archivo";}else {echo "No se pu archivo";}
fclose($archivo);
exit;
?>

MUCHAS GRACIAS
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder