title: How do I make a comment box, using preferablely javascript or php, and then show the comments?
body: <p>I am trying to make a comment box for my website. I can make the background and other items using HTML and CSS, but I want people to be able to leave comments or questions, or concerns.</p>
  <p>I have researched many ways of how I could possibly make a comment box, how to write it out to a file, how to show the comments, and how to update the file, but because I personally don't know PHP or JavaScript I don't know how to do any of that. I have looked at other peoples coding and have managed to come up with something along the lines of this:</p>
  <p>This is for the form, it's an HTML:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="commentf"&gt;
      &lt;table&gt;
          &lt;tbody&gt;
               &lt;FORM action="submit.html" method="post"&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;LABEL for="name"&gt;Name: &lt;/LABEL&gt;
                                &lt;INPUT type="text" id="name"&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;LABEL for="email"&gt;E-Mail: &lt;/LABEL&gt;
                                 &lt;INPUT type="text" id="email"&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;LABEL for="subject"&gt;Subject: &lt;/LABEL&gt;
                                &lt;INPUT type="text" id="subject"&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;LABEL for="comment"&gt;Text: &lt;/LABEL&gt;
                                &lt;TEXTAREA type="text" id="comment"&gt;Comment:&lt;/TEXTAREA&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;INPUT type="submit" value="Submit"&gt; &lt;INPUT type="reset"&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/FORM&gt;
          &lt;/tbody&gt;
      &lt;/table&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>And this is the PHP file (saved as an HTML, for some reason when I try to open it as a PHP file it opens a save as box instead of running the PHP, so I just saved it as a HTML) that &quot;processes&quot; the information:</p>
  <pre><code>&lt;?php
          if(isset($_POST['name']) &amp;&amp; isset($_POST['email'] &amp;&amp; isset ($_POST['subject'] &amp;&amp; isset ($_POST['comment'])))) {
          $data = $_POST['name'] . '-' . $_POST['email'] . '-' . $_POST['subject'] . '-' . $_POST['comment'] . &quot;\n&quot;;
          $ret = file_put_contents('HAS.txt', $data, FILE_APPEND | LOCK_EX);
          if($ret === false) {
          die('There was an error writing this file');
      }
      else {
          echo &quot;$ret bytes written to file&quot;;
      }
  }
  else {
     die('no post data to process');
  }
  </code></pre>
  <p>Lastly, this is part of the html that I first displayed, so that it would show the comments.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    &lt;div class="postcomment"&gt;
               &lt;FORM&gt;
                      &lt;br&gt;Name:&lt;/b&gt; &lt;?php echo $_POST['name']; ?&gt; &lt;INPUT type="text" id="name"&gt;
                      &lt;br&gt;E-Mail:&lt;/b&gt; &lt;?php echo $_POST['email']; ?&gt; &lt;INPUT type="text" id="email"&gt;
                      &lt;br&gt;Subject:&lt;/b&gt; &lt;?php echo $_POST['subject']; ?&gt; &lt;INPUT type="text" id="subject"&gt;
                      &lt;br&gt;Comment:&lt;/b&gt; &lt;?php echo $_POST['comment']; ?&gt; &lt;TEXTAREA type="text" id="comment"&gt;&lt;/TEXTAREA&gt;
               &lt;/FORM&gt;
          &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>