SHOW:
|
|
- or go back to the newest paste.
| 1 | - | echo "<hr><div class='homeBlog'>"; |
| 1 | + | while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
| 2 | - | echo "<a href='javascript:toggleDivFast(\"msg-".$a."\")'><h3 style='margin-left:30px;'>".$row['title']."</a></h3>"; |
| 2 | + | $messages[] = $row; |
| 3 | - | echo "<h5 style='margin-left:30px; margin-bottom:20px; margin-top:-15px;'>from ".$row['sender']."</h5>"; |
| 3 | + | $a++; |
| 4 | - | echo "<div id='msg-".$a."' ".$b." ><p>".stripslashes($row['message'])."</p>"; |
| 4 | + | |
| 5 | - | |
| 5 | + | if($a!==1){
|
| 6 | - | echo "<a href='javascript:toggleDivFast(\"homeComments-".$a."\")'><h4 style='margin-left:60px;'>Comments</h4></a>"; |
| 6 | + | $b = "style='display:none;'"; |
| 7 | - | echo '<div id="homeComments-'.$a.'" '.$b.'">'; |
| 7 | + | } else {
|
| 8 | - | echo displayComments($row['id']); |
| 8 | + | $b = ""; |
| 9 | - | |
| 9 | + | } |
| 10 | - | $id_cmt = $row['id']; |
| 10 | + | |
| 11 | - | $usr = $_SESSION['user']; |
| 11 | + | echo "<hr><div class='homeBlog'>"; |
| 12 | - | |
| 12 | + | echo "<a href='javascript:toggleDivFast(\"msg-".$a."\")'><h3 style='margin-left:30px;'>".$row['title']."</a></h3>"; |
| 13 | - | echo '<div style="margin:40px;">'; |
| 13 | + | echo "<h5 style='margin-left:30px; margin-bottom:20px; margin-top:-15px;'>from ".$row['sender']."</h5>"; |
| 14 | - | |
| 14 | + | echo "<div id='msg-".$a."' ".$b." ><p>".stripslashes($row['message'])."</p>"; |
| 15 | - | echo '<form action="post_comment.php" method="POST" name="cmtForm-'.$a.'">'; |
| 15 | + | |
| 16 | - | echo '<textarea style="width:100%; height:100px;" name="msg" placeholder="Comment here">This is a test</textarea>'; |
| 16 | + | echo "<a href='javascript:toggleDivFast(\"homeComments-".$a."\")'><h4 style='margin-left:60px;'>Comments</h4></a>"; |
| 17 | - | echo '<input type="hidden" value="'.$id_cmt.'" name="id_cmt" />'; |
| 17 | + | echo '<div id="homeComments-'.$a.'" '.$b.'">'; |
| 18 | - | echo '<input type="hidden" value="'.$usr.'" name="usr" />'; |
| 18 | + | echo displayComments($row['id']); |
| 19 | - | echo '<input type="submit" value="Add comment" style="margin:0; width:100%; height:25px; font-size:12px; color:black; text-shadow:none; font-family:\'roboto\', sans-serif;" />'; |
| 19 | + | |
| 20 | - | echo '</div></div></div></div>'; |
| 20 | + | $id_cmt = $row['id']; |
| 21 | $usr = $_SESSION['user']; | |
| 22 | ||
| 23 | echo '<div style="margin:40px;">'; | |
| 24 | ||
| 25 | echo '<form action="post_comment.php" method="POST" name="cmtForm-'.$a.'">'; | |
| 26 | echo '<textarea style="width:100%; height:100px;" name="msg" placeholder="Comment here">This is a test</textarea>'; | |
| 27 | echo '<input type="hidden" value="'.$id_cmt.'" name="id_cmt" />'; | |
| 28 | echo '<input type="hidden" value="'.$usr.'" name="usr" />'; | |
| 29 | echo '<input type="submit" value="Add comment" style="margin:0; width:100%; height:25px; font-size:12px; color:black; text-shadow:none; font-family:\'roboto\', sans-serif;" />'; | |
| 30 | echo '</div></div></div></div>'; | |
| 31 | } |