title: How to show a box for comment reply with id
body: <p>My reply only work in last/new comment. if i reply others comment its show a blank space only in text area.</p>
  
  <p>Test case: If I REPLACE REPLY FORM AT THE END of wall.php page, apply css display:block to show it always, click a reply button for parent id and submit after write any text then it work but click to reply button cannot open to it's own reply form.</p>
  
  <p>How to open my reply form with each comment if I replace it at end of page? </p>
  
  <p>wall.php (current case: as above link which not save any textarea data of old comments)</p>
  
  <pre><code>script type='text/javascript'&gt;
    $(function(){
      $("a.reply").click(function() {
      var id = $(this).attr("id");
      $("#parent_id").attr("value", id);
      });
    });
  &lt;/script&gt;
  
  &lt;script&gt;
  $('a.reply').livequery("click",function() {
     var ID = $(this).attr('id').replace('','');
     $("#reply_here-"+ID).slideToggle('slow');
     return false;
  }); 
  &lt;/script&gt;
  &lt;/head&gt;
  
  
  global $dbh;
  $results = mysqli_query($dbh,"SELECT * FROM comments_lite WHERE qazi_id='$tutid' ORDER BY id DESC LIMIT 5") or die(mysqli_error($dbh));
  //find the number of comments
  list($commentNum) = mysqli_fetch_array(mysqli_query($dbh,"SELECT COUNT(*) FROM comments_lite WHERE qazi_id='$tutid'"));
  
  echo'&lt;div class="comments"&gt;&lt;div id="updates"&gt;&lt;div class="content"&gt;&lt;comment&gt;';
  
  while($rows = mysqli_fetch_array($results)) 
  {
  $id = $rows['id'];
  $qazi_id = $rows['qazi_id'];
  $likes = $rows['likes'];
  $username = $rows['username'];
  $img = $rows['img'];
  $description = $rows['description'];        
  $url = $rows['url'];
  $parent_id = $rows['parent_id'];
  $date = $rows['date'];
  
      echo'&lt;div class="comment"&gt;
          &lt;div class="cdomment_cheder"&gt;';
          if ($url=="") {
          echo'&lt;p class="name"&gt;'.$username.' Says:&lt;/p&gt;'; }
          else  echo'&lt;p class="name"&gt;&lt;a href="userinfo.php?user='.$url.'" title="'.$username.'"&gt;'.$username.'&lt;/a&gt; Says:&lt;/p&gt;';
          echo'&lt;span class="cdomment_time"&gt;'.$date.'&lt;/span&gt;&lt;br/&gt;
          &lt;div class="avatarcnt"&gt;
          &lt;img alt="" src="uploadprofile/'.$u_imgurl.'"/&gt;
          &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
          &lt;div class="cdomment_text"&gt;';
          if ($description=="") {echo '';}
          else echo''.htmlentities($description).'&lt;br&gt;';
          echo '&lt;/div&gt;';
  
  
  //reply
  echo'&lt;div class="reply_box"&gt;&lt;a href="javascript: void(0)" class="reply" id="'.$id.'"&gt;Reply&lt;/a&gt;&lt;/div&gt;';
  
  //Likes
  echo'&lt;div&gt;&lt;/div&gt;'; 
  
  // Only Reply 
  $query = "SELECT * FROM comments_reply WHERE parent_id ='".$id."' ORDER BY id DESC";
  $res = mysqli_query($dbh,$query);
  while($row = mysqli_fetch_array($res)){   
  $id = $row['id'];
  $qazi_id = $row['qazi_id'];
  $likes = $row['likes'];
  $username = $row['username'];
  $img = $row['img'];
  $description = $row['description'];     
  $url = $row['url'];
  $parent_id = $row['parent_id'];
  $date = $row['date'];
  
          echo' &lt;div class="rcontent"&gt;&lt;replycomment&gt;&lt;ul&gt;
          &lt;div class="comment"&gt;
          &lt;div class="cdomment_cheder"&gt;';
          if ($url=="") {
          echo'&lt;p class="name"&gt;'.$username.' Says:&lt;/p&gt;'; }
          else  echo'&lt;p class="name"&gt;&lt;a href="userinfo.php?user='.$url.'" title="'.$username.'"&gt;'.$username.'&lt;/a&gt; Says:&lt;/p&gt;';
          echo'&lt;span class="cdomment_time"&gt;'.$date.'&lt;/span&gt;&lt;br/&gt;
          &lt;div class="avatarcnt"&gt;
          &lt;img alt="" src="uploadprofile/'.$u_imgurl.'"/&gt;
          &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
          &lt;div class="cdomment_text"&gt;';
          if ($description=="") {echo '';}
          else echo''.htmlentities($description).'&lt;br&gt;';
          echo '&lt;/div&gt;';
  
          &lt;/ul&gt;&lt;replycomment&gt;&lt;/div&gt;'; 
  
  }   //reply close   
  ?&gt;
  
  // REPLY FORM
  &lt;div id="loader"&gt;&lt;/div&gt;&lt;div class="reply_here" id="reply_here-&lt;?php echo $rows['id'] ?&gt;" style="display:none;"&gt;
      &lt;form action="" method="post" id="repfrm"&gt;
        &lt;fieldset id="cmntfs"&gt;
          &lt;legend class="pyct"&gt;Your comment&lt;/legend&gt;
          &lt;input type="hidden" name="username" id="author" value="&lt;?php echo $_SESSION['username'] ?&gt;"/&gt;
          &lt;input type="hidden" name="url" id="url" value="" /&gt;
          &lt;div id="maintbox"&gt;
          &lt;textarea name="replycom" rows="2" id="replycom"&gt;&lt;/textarea&gt;
          &lt;/div&gt;
          &lt;input type="hidden" name="parent_id" id="parent_id" value="0" /&gt;
          &lt;input type="hidden" name="tutid" id="tutid" value="&lt;?php echo $tutid ?&gt;" /&gt;
          &lt;button type="submit" name="submit" value="" id="submit" class="repfrm"&gt;Post Reply&lt;/button&gt;
        &lt;/fieldset&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  &lt;?
  }    //comment close
  
  echo'&lt;/div&gt;&lt;comment&gt;&lt;/div&gt;';
  
  //pagination 
  </code></pre>
  
  <p>wall.php (tast case: this not open each reply form when form placed at the end of page)</p>
  
  <pre><code>script type='text/javascript'&gt;
  $(function(){
   $("a.reply").click(function() {
    var id = $(this).attr("id");
   $("#parent_id").attr("value", id);
   });
  });
  &lt;/script&gt;
  
  &lt;script&gt;
  $('a.reply').livequery("click",function() {
   var ID = $(this).attr('id').replace('','');
    $("#reply_here-"+ID).slideToggle('slow');
    return false;
  }); 
  &lt;/script&gt;
  &lt;/head&gt;
  
  
  global $dbh;
  $results = mysqli_query($dbh,"SELECT * FROM comments_lite WHERE qazi_id='$tutid' ORDER BY id DESC LIMIT 5") or die(mysqli_error($dbh));
  //find the number of comments
  list($commentNum) = mysqli_fetch_array(mysqli_query($dbh,"SELECT COUNT(*) FROM comments_lite WHERE qazi_id='$tutid'"));
  
  echo'&lt;div class="comments"&gt;&lt;div id="updates"&gt;&lt;div class="content"&gt;&lt;comment&gt;';
  
  while($rows = mysqli_fetch_array($results)) {
  $id = $rows['id'];
  $qazi_id = $rows['qazi_id'];
  $likes = $rows['likes'];
  $username = $rows['username'];
  $img = $rows['img'];
  $description = $rows['description'];        
  $url = $rows['url'];
  $parent_id = $rows['parent_id'];
  $date = $rows['date'];
  
      echo'&lt;div class="comment"&gt;
          &lt;div class="cdomment_cheder"&gt;';
          if ($url=="") {
          echo'&lt;p class="name"&gt;'.$username.' Says:&lt;/p&gt;'; }
          else  echo'&lt;p class="name"&gt;&lt;a href="userinfo.php?user='.$url.'" title="'.$username.'"&gt;'.$username.'&lt;/a&gt; Says:&lt;/p&gt;';
          echo'&lt;span class="cdomment_time"&gt;'.$date.'&lt;/span&gt;&lt;br/&gt;
          &lt;div class="avatarcnt"&gt;
          &lt;img alt="" src="uploadprofile/'.$u_imgurl.'"/&gt;
          &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
          &lt;div class="cdomment_text"&gt;';
          if ($description=="") {echo '';}
          else echo''.htmlentities($description).'&lt;br&gt;';
          echo '&lt;/div&gt;';
  
  
  //reply
  echo'&lt;div class="reply_box"&gt;&lt;a href="javascript: void(0)" class="reply" id="'.$id.'"&gt;Reply&lt;/a&gt;&lt;/div&gt;';
  
  //Likes
  echo'&lt;div&gt;&lt;/div&gt;'; 
  
  // Only Reply 
  $query = "SELECT * FROM comments_reply WHERE parent_id ='".$id."' ORDER BY id DESC";
  $res = mysqli_query($dbh,$query);
  while($row = mysqli_fetch_array($res)){   
  $id = $row['id'];
  $qazi_id = $row['qazi_id'];
  $likes = $row['likes'];
  $username = $row['username'];
  $img = $row['img'];
  $description = $row['description'];     
  $url = $row['url'];
  $parent_id = $row['parent_id'];
  $date = $row['date'];
  
          echo' &lt;div class="rcontent"&gt;&lt;replycomment&gt;&lt;ul&gt;
          &lt;div class="comment"&gt;
          &lt;div class="cdomment_cheder"&gt;';
          if ($url=="") {
          echo'&lt;p class="name"&gt;'.$username.' Says:&lt;/p&gt;'; }
          else  echo'&lt;p class="name"&gt;&lt;a href="userinfo.php?user='.$url.'" title="'.$username.'"&gt;'.$username.'&lt;/a&gt; Says:&lt;/p&gt;';
          echo'&lt;span class="cdomment_time"&gt;'.$date.'&lt;/span&gt;&lt;br/&gt;
          &lt;div class="avatarcnt"&gt;
          &lt;img alt="" src="uploadprofile/'.$u_imgurl.'"/&gt;
          &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
          &lt;div class="cdomment_text"&gt;';
          if ($description=="") {echo '';}
          else echo''.htmlentities($description).'&lt;br&gt;';
          echo '&lt;/div&gt;';
  
          &lt;/ul&gt;&lt;replycomment&gt;&lt;/div&gt;'; 
  
  }   //reply close   
  }    //comment close
  ?&gt;
  
  // REPLY FORM
  &lt;div id="loader"&gt;&lt;/div&gt;&lt;div class="reply_here" id="reply_here-&lt;?php echo $rows['id'] ?&gt;" style="display:block;"&gt;
      &lt;form action="" method="post" id="repfrm"&gt;
        &lt;fieldset id="cmntfs"&gt;
          &lt;legend class="pyct"&gt;Your comment&lt;/legend&gt;
          &lt;input type="hidden" name="username" id="author" value="&lt;?php echo $_SESSION['username'] ?&gt;"/&gt;
          &lt;input type="hidden" name="url" id="url" value="" /&gt;
          &lt;div id="maintbox"&gt;
          &lt;textarea name="replycom" rows="2" id="replycom"&gt;&lt;/textarea&gt;
          &lt;/div&gt;
          &lt;input type="hidden" name="parent_id" id="parent_id" value="0" /&gt;
          &lt;input type="hidden" name="tutid" id="tutid" value="&lt;?php echo $tutid ?&gt;" /&gt;
          &lt;button type="submit" name="submit" value="" id="submit" class="repfrm"&gt;Post Reply&lt;/button&gt;
        &lt;/fieldset&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  &lt;?
  echo'&lt;/div&gt;&lt;comment&gt;&lt;/div&gt;';
  
  //pagination 
  </code></pre>