SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast akstar's Avatar
    Join Date
    Feb 2009
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to click on the "Title" and view more details ?

    Hi guys,
    My table displays the date, company, country and title fields.
    Code:
    Example
    Date     Company     Country          Title
    April 25 Joel Osteen  United States  Historic Night of Hope
    PHP Code:
    echo "<table border='0'>
    <tr>
    <th>Date</th>
    <th>Company</th>
    <th>Country</th>
    <th>Title</th>

    </tr>"
    ;
    //run the while loop that grabs all the announcement
    while($row mysql_fetch_array($result))  
     {

    echo 
    "<tr>";
    echo 
    "<td>" .date("F d",strtotime($row['startdate'])). "</td>";
    echo 
    "<td>" $row['company1'] . "</td>";
    echo 
    "<td>" $row['D1'] . "</td>";
    echo 
    "<td>" $row['title1'] . "</td>";
     echo 
    "</tr>";

     }
    echo 
    "</table>"




    Problem: All in just normal text
    Question 1: How to I make the "title" clickable into a new window that only displays that row ?
    Information: I think its something to do with <a href..> , my row has a primary key called "id".


    Problem 2: After it has display that row in a nice new window, I would like to allow my users who has logged in with SESSIONS to be able to leave comments.
    Question 2: How to I code that ?



    Thanks once again Lovely Sitepoint people for every help, advice and assistance given!

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    echo '<td><a href="comment.php?id=' $row['id'] . '">' $row['title1'] . "</a></td>"
    comment.php will use $_GET['id'] to retrieve info from the database. To allow users to post comments, you want to make a new table which stores the userid and the id of the record the comment is about(the company id?), as well as the comment text, and maybe the date/time.

    If you want to make a small popup window, you need to use javascript. You can google for window.open(). I would worry about that later.

  3. #3
    SitePoint Enthusiast akstar's Avatar
    Join Date
    Feb 2009
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks so much crmalibu,
    It was a success with your codes.


Bookmarks

Posting Permissions

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