<?php
header('Content-Type: text/html; charset=utf-8');
?>
<form action="" method="post">
<p>Ваше имя: <input type="text" name="name" /></p>
<p><textarea rows="10" cols="45" name="usertext"></textarea></p>
<p><input type="submit" /></p>
</form>
<?php
if ($_POST)
{
$fp = fopen('data.txt', 'a');
fwrite($fp, '<div style="margin-bottom: 10px;background:orange;">');
fwrite($fp, $_POST['name']);
fwrite($fp,"<br>");
fwrite($fp,$_POST['usertext']);
fwrite($fp,"<br>");
fwrite($fp, '</div>');
fclose($fp);
$handle = fopen('data.txt', 'r');
$contents = fread($handle,filesize('data.txt'));
echo $contents;
fclose($handle);
}
?>
|