how to click and capture text

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dragon52
    New Member
    • Jun 2009
    • 72

    how to click and capture text

    Hi,

    I am displaying a table of records, one column is the student id. What html code do I need to allow user to select a student record by a click of a student id. In other words how do I make the id column clickable and at the same time capture the id number so I can process and display that student's details?

    Thanks
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    It depends on how the records are displayed. You can just make the record an anchor with the id as part of the href.
    Code:
    <a href="example.com/mypage?record=12345">ID12345</a>
    
    or
    
    <a href="example.com/mypage/record/12345>ID12345</a>

    Comment

    • dragon52
      New Member
      • Jun 2009
      • 72

      #3
      Thanks drhowarddrfine,

      It is now clickable but..

      How do I click to refresh the same page to display student details?

      What code do I use to get hold of the student id?

      Here is my code

      Code:
      while ($row = mysql_fetch_array($result)) {
      echo "<tr><td>";
      echo "<a href='example.com/mypage?record=".$row['StudentID']."'>".$row['StudentID']."</a>";
      echo "</td><td>"."-".$row['FamilyName'].", ".$row['GivenNames']."</td></tr>";
      }

      Comment

      • drhowarddrfine
        Recognized Expert Expert
        • Sep 2006
        • 7434

        #4
        Wrong board. Need to ask that question in that language's forum.

        Comment

        • dragon52
          New Member
          • Jun 2009
          • 72

          #5
          drhowarddrfine,

          My previous sample code uses php to output html. However, my question still relates to html. What should the 'href=' statement look like to refresh the same page rather than jumping to another page? Also I need to grap the student id when clicked so that I can look up that record in the db. The 'record' bit in 'href=...record =xyz' is where I can find the id? How should I write that html code?

          Can you help??


          Sorry if I didn't make myself clear.

          Comment

          • drhowarddrfine
            Recognized Expert Expert
            • Sep 2006
            • 7434

            #6
            HTML can't do any of that.

            Comment

            • dragon52
              New Member
              • Jun 2009
              • 72

              #7
              Ok, I will try my luck in the php forum.

              Thanks drhowarddrfine

              Comment

              Working...