Clicked link text

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • c19h28o2

    Clicked link text

    Hi,

    I have created a table on the fly from mysql

    while($row = mysql_fetch_arr ay($query)) {

    echo "<tr>";
    echo "<td class='body'><a href='#'>".$row['au_id']."</a></td>";
    echo "<td class='body'>". $row['au_fname']."</td>";
    echo "<td class='body'>". $row['au_lname']."</td>";
    echo "</tr>";
    }

    is there anyway of getting the current clicked au_id? i would like the
    user to click the id to display more information but I'm unsure how to
    get the currently clicked id...

    Thanks

  • Denis Gerina

    #2
    Re: Clicked link text

    c19h28o2 wrote:
    Hi,
    >
    I have created a table on the fly from mysql
    >
    while($row = mysql_fetch_arr ay($query)) {
    >
    echo "<tr>";
    echo "<td class='body'><a href='#'>".$row['au_id']."</a></td>";
    echo "<td class='body'>". $row['au_fname']."</td>";
    echo "<td class='body'>". $row['au_lname']."</td>";
    echo "</tr>";
    }
    >
    is there anyway of getting the current clicked au_id? i would like the
    user to click the id to display more information but I'm unsure how to
    get the currently clicked id...
    >
    Thanks
    >
    One way:

    while($row = mysql_fetch_arr ay($query)) {
    $auid = $row['au_id'];
    echo "<tr>";
    echo "<td class='body'><a
    href='moreinfo. php?id=$auid'>" .$row['au_id']."</a></td>";
    //or something like
    //echo "<td class='body'><a
    href='moreinfo. php?id={$row['au_id']}'>".$row['au_id']."</a></td>";
    //which I find really ugly :)
    echo "<td class='body'>". $row['au_fname']."</td>";
    echo "<td class='body'>". $row['au_lname']."</td>";
    echo "</tr>";
    }

    On moreinfo.php, you'd have

    <?php
    $auid = $_GET["id"];

    //do something with that particular author...


    ?>

    Comment

    • c19h28o2

      #3
      Re: Clicked link text

      Hi Denis,

      Thanks for you help, works great.

      Comment

      Working...