开发者

Help with my php save to txt file?

开发者 https://www.devze.com 2023-02-21 16:34 出处:网络
well i cant get this script to work! i also need to make it so that onload the user will have their be in the textarea. Please help?

well i cant get this script to work! i also need to make it so that onload the user will have their be in the textarea. Please help?

<?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; b开发者_开发知识库order: 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>


<textarea ... is missing name attribute in your case it would be name="content"

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号