Ok, I'm trying to create a very simple php script that you can fill out the forms, then click submit and it writes it to the page.. I've achieved that... but now I'm trying to set the "pointer" to the beginning so it writes to the top.. listing the updates newest to oldest.. but it just doesn't work and my "r+" is acting like an "a"
<?php
if($_POST['submit'] && (!$_POST['message'] || !$_POST['name']))
{ echo "Missing data, try again"; }
elseif (!$_POST['submit'])
{ }
else {
//passthru("touch test.html");
$file = fopen("test.html", "r+");
$string = ''.$_POST['message'].' <BR> '.$_POST['name'].' ';
fwrite($file, $string);
echo "Success, thank you!";
fclose($file);
exit;
}
echo '<iframe src="test.html" frameborder="0" height="100" width="410"></iframe> <br>
<form method="post" action="'.$_SERVER['PHP_SELF'].'">
message:<br> <textarea name="message" rows="4" cols="45"></textarea><br>
name:<br> <input type="text" name="name" width="25"><br>
<input type="hidden" name="submit" value=1>
<input type="submit" value="Submit"> <input type="reset" value="Clear"></form>'
?>
edit: the test.html page is absolutely blank, I've gotten r+ to work with txt. But I can't set the background color for the txt to fit in with the page in the iframe. So if theres any solutions to that.. I'm open to those too.