title: Unique HTML id's via a PHP loop
body: <p>First, I'm new to form and looking forward to all your insight. </p>
  
  <p>My issue: I'm building a small site and I've run into a problem generating unique HTML ids. I'm generating the HTML via a loop in PHP, sent to a smarty template. I admit, my JavaScript abilities are not good which is why I can't figure this out… All I want to is to display the comment form under each article when the "add a Comment" link is clicked. </p>
  
  <p>Here is the JavaScript - </p>
  
  <pre><code>&lt;script&gt;
      function show_cform() {
          o = document.getElementById("comment_link");
          if (o) { o.style.display = ""; }
          o = document.getElementById("comment_form");
          if (o) { o.style.display = "none"; }
      }   
  &lt;/script&gt; 
  </code></pre>
  
  <p>And the HTML that repeats several times -   </p>
  
  <pre><code>&lt;div id="comment_form"&gt;
      &lt;!-- Article Content Here --&gt;
      &lt;a href="javascript:show_cform();"&gt;Add a Comment&lt;/a&gt;
  &lt;/div&gt;
  
  &lt;div id="comment_link" style="display: none;"&gt;
      &lt;form method="post" action="blog_comment.php"&gt;
          &lt;input type="hidden" name="ID" value="{$id}"&gt;
          Your Name:&lt;br /&gt;
          &lt;input name="name" type="text" /&gt;
          &lt;br /&gt;&lt;br /&gt;
          Comment:&lt;br /&gt;
          &lt;textarea name="comment" rows="8" cols="40"&gt;&lt;/textarea&gt;
          &lt;br /&gt;&lt;br /&gt;
          &lt;input type="submit" value="Post comment"&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Thanks in advance for the help!</p>