<?php
//the path to any file
$fn = "test.txt";
if (isset($_POST['content'])) {
$content = stripslashes($_POST['content']);
$fp = fopen($fn, "w") or die("Error opening file in write mode!");
fputs($fp, $content);
fclose($fp) or die("Error closing file!");
}
?>
<form action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post">
<textarea style="font-family: Marker Felt; font-size: 16px; background-color: transparent; border: none; height:159px; resize: none;" id="myDiv"><?php readfile($fn); ?></textarea>
<br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/>
<br/>
<input type="submit" value="Save">
</form>
答案 0 :(得分:3)
<textarea ...
在您的情况下缺少名称属性name="content"