Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/07/2009, 14:31
alex1195
 
Fecha de Ingreso: diciembre-2008
Ubicación: Mi Casa =D
Mensajes: 292
Antigüedad: 15 años, 4 meses
Puntos: 5
Crear un txt con el contenido de otro txt

Hola, el caso es este....
Estaba haciendo un Guestbook muy simple, es solo para practicar, no pensaba publicarlo, pero no me funciona.
Lo que quería era abrir un txt y dentro de el, poner el contenido de otro txt.
Se me ocurria hacerlo asi:

INDEX.HTML
Código PHP:
<HTML>
<
head>
<
title>GuestBook</title>
</
head>
<
body>
<
div align="center">
<
h1>GuestBook</h1>
<
form method="post" action="firmar.php">
Nombre:<input type="text" name="nombre"><br>
Tu web:<input type="text" name="web"><br>
Tu mensaje:<input type="text" name="mensaje"><br>
<
input type="submit" Value="Ya">
</
div>
</
body>
</
HTML
FIRMAR.PHP
Código PHP:
<?php
$nombre 
$_POST["nombre"];
$web $_POST["web"];
$mensaje $_POST["mensaje"];
$contenido fopen("texto.txt""r");

$archivo fopen("mensajes.txt""a+");
fwrite($archivo,$contenido);
?>
TEXTO.TXT
Código PHP:
Nombre:<?php echo $_POST["nombre"]; ?><br>
Sitio Web:<?php echo $_POST["web"]; ?><br>
Mensaje:<?php echo $_POST["mensaje"]; ?><br><br><br>
Bueno, espero que me puedan ayudar y se tomen el tiempo para leer y entender el script.. gracias ^-^