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>
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);
?>
Código PHP:
Nombre:<?php echo $_POST["nombre"]; ?><br>
Sitio Web:<?php echo $_POST["web"]; ?><br>
Mensaje:<?php echo $_POST["mensaje"]; ?><br><br><br>