1
People have this code, it records the data captured from the form in an HTML page, but if I send a post and then send another, the most recent post is always down, but I want it to stay up (as it happens in a blog).
How do you fix this?
Thanks for your help.
<?php
$file = 'abc.html'; // Open the file to get existing content
$current = file_get_contents($file); // Append a new person to the file
$current .= $_POST ["top"];
$current .= '<br>';
$current .= $_POST ["texto"];
$current .= '<br>';
$current .= '<img alt="" src="images/';
$current .= $_FILES ['imagem'][name]; $current .= '">';
$current .= '<br>';
$current .= $_POST ["rodape"];
$current .= '<br><br>'; // Write the contents back to the file
file_put_contents($file, $current);
?>
<form class="form-horizontal" method="POST" action="envia.php" enctype="multipart/form-data">
<body style="color: rgb(0, 0, 0); background-color: transparent;" alink="#000099" link="#000099" vlink="#990099">
<video autoplay="" loop="" poster="URL-FUNDO" class="bg_video"> <source src="video/bg.webm" type="video/webm"> <source src="video/bg.mp4" type="video/mp4"> </source> </source></video>
<div class="cabecalho">
<a id='inicio'></a>
<table
style="width: 100%; height: 100%; text-align: left; margin-left: auto; margin-right: auto;" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="height: 100px; text-align: center;"><p>
</p>
<p>
<span style="font-family: Arial, Helvetica, sans-serif; color: rgb(51, 51, 51); font-weight: bold;">Top:</span></big><br />
<textarea required="required" name="top" id="top" cols="40" rows="7" style="font-family: Arial; font-size: 16px"></textarea>
</p>
<p>
<span style="font-family: Arial, Helvetica, sans-serif; color: rgb(51, 51, 51); font-weight: bold;">Texto:</span></big><br />
<input type="text" required="required" size="40" name="texto" style="font-family: Arial; font-size: 16px">
</p>
<p>
<input type="file" name="imagem" id="imagem" multiple>
</p>
<p>
<p>
<span style="font-family: Arial, Helvetica, sans-serif; color: rgb(51, 51, 51); font-weight: bold;">Rodapé:</span></big><br />
<textarea required="required" name="rodape" id="rodape" cols="40" rows="7" style="font-family: Arial; font-size: 16px"></textarea>
</p>
<p>
<button type="image" name="gravar" value="Gravar" id="gravar"><img style="width: 130px; height: auto;" src="../img/enviar.png"></button>