2014-07-24 2 views
0

PHP 스크립트를 일반 텍스트 파일에 쓰려고합니다. 전에이 작업을 해봤지만 제대로 작동했습니다. 그러나 이번에는 어떤 이유로 든 작동하지 않습니다.PHP 5.3 일반 텍스트에 내용 쓰기

<!DOCTYPE html> 
<html lang="en"> 
    <head> 
     <meta charset="utf-8" /> 
     <link rel="stylesheet" type="text/css" href="/css/feedback.css" > 
     <title>Questions, Comments, Suggestions</title> 
    </head> 
    <body> 
     <p class="title">Questions, comments, and suggestions here!</p> 
      <form method="post" name="userFeedback" action="/submit.php"> 
      <textarea id="comments" placeholder="Leave a comment or review here..."></textarea> 
      <textarea id="name" placeholder="Your name here"></textarea> 
      <textarea id="contact" placeholder="Put any means of contact you want to here (optional)"></textarea> 
      <br> 
      <input class="enter" type="submit" value="Enter"> 
     </form> 
    </body> 
</html> 

나는이 그렇게하고 싶지는 모든 PHP 5.3 .txt 파일 일반에 입력 한대로 인쇄하는 것입니다
여기 내가 사용하고있는 HTML이다. 다음은 코드입니다.

$data = ($_POST["comments"] ." || ". $_POST["name"] ." || ". $_POST["contact"]); 
    $data = strip_tags($data); 

    $file = "feedback.txt"; 
    $f = fopen($file, "a+"); 

    fwrite($f, $data . "\n" . "\n"); 

    fclose($f); 

    header ('Location: index.html'); 

5.3을 사용하고 있습니다. 여기 어딘가에 단순한 오류가있을 것이라고 확신합니다. 누군가 이걸로 나를 도울 수 있습니까? 미리 감사드립니다.

답변

0

우리는 그것을 얻었다! PHP $ _POST 메서드는 "id"가 아닌 "name"속성을 찾습니다.