Спустя 30 минут, 24 секунды (26.09.2010 - 13:25) Mizka написал(а):
как-то так:)
<?php
function fileRead(){
$filename = './test.dat';
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
return $contents;
}
function fileWrite($inputText){
$filename = './test.dat';
$handle = fopen($filename, "w");
$fileWrite = fwrite($handle, $inputText);
if($fileWrite === false){
echo 'an error occurs on attempt to update file';
}
}
if(isset($_POST['update_file'])){
fileWrite($_POST['update_file']);
}
?>
<html>
<body>
<form name="test" method="post">
<textarea name="update_file"><?php echo fileRead();?></textarea></br>
<input type="submit">
</form>
</body>
</html>