Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jul 2010
    Posts
    44
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Making a comment box drop down on link click

    Hi.
    So, I have this loop I run to retrieve wallposts with php. Within this loop, I want a link/button on every post that says "comment". When the user clicks the comment link I want a comment field and post button to appear on the post I clicked on. The problem is that when I've tried making a link that does this, it only drops down the comment field on the most recent wallpost regardless of which wallpost I click on.

    I'd appreciate some help, a lot!

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    So, I have this loop I run to retrieve wallposts with php.
    Where's your code?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    Mar 2010
    Location
    New Jersey USA
    Posts
    81
    Thanks
    13
    Thanked 4 Times in 4 Posts
    Quote Originally Posted by fenhopi View Post
    I want a link/button on every post that says "comment". When the user clicks the comment link I want a comment field and post button to appear on the post I clicked on
    something like this?

    Code:
          <form name="myForm" id="form1" method="post"> 
               <input type="text" name="comments" id="myText" value="Enter in Text" /> 
               <input type="button" name="button" value="Hide Text Box"  
               onclick="document.getElementById('myText').style.visibility='hidden';"/> 
               <input type="button" name="button" value="Show Text Box"  
               onclick="document.getElementById('myText').style.visibility='visible';"/> 
         </form>

  • #4
    New Coder
    Join Date
    Jul 2010
    Posts
    44
    Thanks
    1
    Thanked 0 Times in 0 Posts
    PHP Code:
                $username = mysql_real_escape_string($_SESSION['username']);
                $friend_statuses = "SELECT * FROM oodles WHERE byuser='$username' ORDER BY dtime DESC LIMIT 0, 10";
                
                    
                $result = $database->query($friend_statuses);
                
                
                
                // Loop
                While($myrow = mysql_fetch_array($result))
                {
                    //VARS
                    $user = mysql_real_escape_string($myrow['byuser']);
                    $oodleid = mysql_real_escape_string($myrow['oodleid']);
                    //selecting who liked oodle
        
                    
                    //Get his name
                    $findnamequery = "SELECT * FROM users WHERE username='$id'";
                    $connectfindname = $database->query($findnamequery);
                    $findname = mysql_fetch_array($connectfindname);
                
                        
                    //Echoes
                    $oodle = $myrow['oodle'];
                    $oodlesecure = htmlentities($oodle);
                    ?>
                     <table width="200" border="0">
                      <tr>
                          <td width="739">
                            <h2><a href="profile.php?user=<? echo $id?>"><img src="view.php?user=<? echo $id?>"  width=55 height=40> 
                            <? echo $findname['firstname']; ?> <? echo $findname['lastname']; ?></a> 
                            <? echo $oodlesecure?> </h2>
                       </td>
                     </tr>
                      
                    
                            <?
                                
    }
                        
                            }
                    
    ?>
                        </td>
                    </tr>
                      <tr>
                        <td><? echo "Posted: " .$myrow['dtime']; ?></td>
                      </tr>
                    </table>
                     
    <?    
                    
                
    }
    Before the dtime, is where I'd like to put the comment option.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •