Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8462469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:10:22+00:00 2026-06-10T14:10:22+00:00

<table class=table table-striped> <thead> <tr> <th>Select</th> <th>From</th> <th>Subject</th> <th>Date</th> </tr> </thead> <tbody> <?php //show

  • 0
<table class="table table-striped">  
            <thead>  
            <tr>  
                <th>Select</th>  
                <th>From</th>  
                <th>Subject</th>  
                <th>Date</th>  
            </tr>
            </thead>
            <tbody>  
        <?php
            //show records
            while ($row = mysql_fetch_array($usrmsg)) {

            $frm_user = $row['from_uid'];
            // Get details from users_profiles table.
            $usrname = mysql_query("select * from `users_profiles` where `id`=$frm_user");
            $usrname = mysql_fetch_array($usrname);
        ?>
            <tr>  
                <td> <label class="checkbox"><input type="checkbox"></label> </td>  
                <td><?php echo $usrname['firstname'] . " " . $usrname['lastname'];?> </td>  
                <td><!-- <a href="<?php echo $row['id']; ?>" id="getmsg"><?php echo substr($row['subject'],0,40); ?>...</a> -->
                 <input class="data" type="text" value="<?php echo $row['id']; ?>" id="<?php print $row['id']; ?>" />
                 <input type="button" href="#get-content" class="clickme" value="<?php echo substr($row['subject'],0,40); ?>.." id="<?php print $row['id']; ?>"/>
                </td>  
                <td><?php echo $row['date']; ?></td>  
            </tr> 
        <?php
            }   
        ?>
        </tbody>  
       </table>  
       <div id="content">
            The table will be placed here
        </div>

I am loading the records from DB in table. Now when user click on subject line my JQUERY AJAX should display the message in the DIV Content. that is correctly happening but only for first record. and when i click on second record it still display the first record that i dont want what i want is when user click on the record the corresponding message should display and not always first.

actually my JQUERY AJAX is always passing the first record id to message.php which is 10 in my case.

here is the jquery.

<script type="text/javascript" >
    $(document).ready(function(){
        $(".clickme").click(function() {
            $("#content").html('Retrieving...');
            $.ajax({
                type: "GET",
                data: "data=" + $(".data").val(),
                url: "message.php",
                dataType: 'json', 
                success: function(data){
                var msg = data[0];              //get id
                $("#content").html(msg);
                }
            });
        });
    });
</script>

if someone can help me that would be great…

THank you in advance..

Below is the plan HTML

<table class="table table-striped">  
            <thead>  
            <tr>  
                <th>Select</th>  
                <th>From</th>  
                <th>Subject</th>  
                <th>Date</th>  
            </tr>
            </thead>
            <tbody>  
                    <tr>  
                <td> <label class="checkbox"><input type="checkbox"></label> </td>  
                <td>Raj Janorkar </td>  
                <td><!-- <a href="10" id="getmsg">This is proposal for you.....</a> -->
                 <input class="data" type="text" value="10" id="10" />
                 <input type="button" href="#get-content" class="clickme" value="This is proposal for you...." id="10"/>
                </td>  
                <td>2012-08-26</td>  
            </tr> 
                    <tr>  
                <td> <label class="checkbox"><input type="checkbox"></label> </td>  
                <td>Raj Janorkar </td>  
                <td><!-- <a href="11" id="getmsg">All Messages Are Monitored..if we found ...</a> -->
                 <input class="data" type="text" value="11" id="11" />
                 <input type="button" href="#get-content" class="clickme" value="All Messages Are Monitored..if we found .." id="11"/>
                </td>  
                <td>2012-08-26</td>  
            </tr> 
                    <tr>  
                <td> <label class="checkbox"><input type="checkbox"></label> </td>  
                <td>Raj Janorkar </td>  
                <td><!-- <a href="12" id="getmsg">All Messages Are Monitored All Messages ...</a> -->
                 <input class="data" type="text" value="12" id="12" />
                 <input type="button" href="#get-content" class="clickme" value="All Messages Are Monitored All Messages .." id="12"/>
                </td>  
                <td>2012-08-26</td>  
            </tr> 
                    <tr>  
                <td> <label class="checkbox"><input type="checkbox"></label> </td>  
                <td>Raj Janorkar </td>  
                <td><!-- <a href="9" id="getmsg">date...</a> -->
                 <input class="data" type="text" value="9" id="9" />
                 <input type="button" href="#get-content" class="clickme" value="date.." id="9"/>
                </td>  
                <td>2012-08-21</td>  
            </tr> 
                    <tr>  
                <td> <label class="checkbox"><input type="checkbox"></label> </td>  
                <td>Raj Janorkar </td>  
                <td><!-- <a href="1" id="getmsg">...</a> -->
                 <input class="data" type="text" value="1" id="1" />
                 <input type="button" href="#get-content" class="clickme" value=".." id="1"/>
                </td>  
                <td>0000-00-00</td>  
            </tr> 
                    <tr>  
                <td> <label class="checkbox"><input type="checkbox"></label> </td>  
                <td>Raj Janorkar </td>  
                <td><!-- <a href="6" id="getmsg">...</a> -->
                 <input class="data" type="text" value="6" id="6" />
                 <input type="button" href="#get-content" class="clickme" value=".." id="6"/>
                </td>  
                <td>0000-00-00</td>  
            </tr> 
                    <tr>  
                <td> <label class="checkbox"><input type="checkbox"></label> </td>  
                <td>Raj Janorkar </td>  
                <td><!-- <a href="7" id="getmsg">...</a> -->
                 <input class="data" type="text" value="7" id="7" />
                 <input type="button" href="#get-content" class="clickme" value=".." id="7"/>
                </td>  
                <td>0000-00-00</td>  
            </tr> 
                    <tr>  
                <td> <label class="checkbox"><input type="checkbox"></label> </td>  
                <td>Raj Janorkar </td>  
                <td><!-- <a href="8" id="getmsg">Hi want to test you...</a> -->
                 <input class="data" type="text" value="8" id="8" />
                 <input type="button" href="#get-content" class="clickme" value="Hi want to test you.." id="8"/>
                </td>  
                <td>0000-00-00</td>  
            </tr> 
                    </tbody>  
           </table>  
           <div id="content">
                The table will be placed here
            </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:10:23+00:00Added an answer on June 10, 2026 at 2:10 pm

    As MrOBRian mentioned your problem is in $(".data").val(). $(".data") will return a collection of all your inputs with class data on the page.

    You should change your selector to something like $(this).siblings('.data').val();. This will give you data inputs next to the clicked button.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have the following table ( JS Fiddle ): <table class=data-table> <thead> <tr>
Lets say I have this table: <table class=table table-striped table-bordered table-condensed> <tr> <th><h1>Tracks</td></th> </tr>
I had a simple table: class test(Base): __tablename__ = 'test' id = Column(Integer, primary_key=True)
If role is an STI table: class Role< ActiveRecord::Base self.inheritance_column= :role_type end And Student
I'm trying to include a simple hash table class in some files with a
I have the following code in my context, and no explicit table-class mapping, yet
I have a table of class players with 5 columns and 40 rows. I
I have tried to find a table with class data in a web page
I'm trying to follow table and class name conventions, but I am not sure
How can I format all td elements contained in a table with class myclass

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.