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

  • Home
  • SEARCH
  • 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 6722745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:29:01+00:00 2026-05-26T09:29:01+00:00

I have a web page and using php Im quering a database and displaying

  • 0

I have a web page and using php Im quering a database and displaying the results in a table like so:

<table id="tablelist">
<thead>
<tr>
<th>Header1</th>
<th>Header2</th>
<th>Header3</th>
</tr>
</thead>
<tbody>
<tr>
<td>Info here1</td>
<td>Info here1</td>
<td class="actions">Action1 - Action2 - Action3</td>
</tr>
<tr>
<td>Info here2</td>
<td>Info here2</td>
<td class="actions">Action1 - Action2 - Action3</td>
</tr>
</tbody>
</table>

Now each row has unique information specific to that row that is from the database. For example the primary id, a date and category. When someone clicks an action for any of the rows I need to obtain those 2 pieces of information specific to the row they clicked. Currently I tried doing this:

<div class="row_data">{info2 in json format}</div>    
<tr>
    <td>Info here1</td>
    <td>Info here1</td>
    <td class="actions">Action1 - Action2 - Action3</td>
    </tr>
<div class="row_data">{info2 in json format}</div>    
<tr>
    <td>Info here2</td>
    <td>Info here2</td>
    <td class="actions">Action1 - Action2 - Action3</td>
    </tr>

So when someone clicked on an action link it would get the previous value of row_data, which is in json format. I would use jquery to parse the json value and use the information found within the rest of the jquery code. But I was told this is invalid html and not recommended. What would be a recommended/optimal way of storying dynamic data per row to use when an action is clicked so I can reference it in my jquery code?

  • 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-05-26T09:29:01+00:00Added an answer on May 26, 2026 at 9:29 am

    The way to do it is use HTML 5’s data attributes:

    <tr id="foo" data-something="put whatever you want in here">
        <!-- content -->
    </tr>
    

    You can then access the information you stored there with

    $("#foo").data("something")
    

    The value of data-something can be anything you like (as long as it’s filtered through htmlspecialchars if you are echoing it straight from PHP), and you can use multiple data attributes if that’s more convenient (usually it is).

    There’s also a post by John Resig on the subject.

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

Sidebar

Related Questions

I have a web page that is being displaying in a winform app using
I have made a Web page using jquery and php where all files are
I have built a web page which contains a Crystal Report built using the
I am working on a web page that is using jQuery. I have an
I have an asp.net web page written in C#. Using some javascript I popup
I have to login into a https web page and download a file using
I'm using Windows Media Player in a web page. I have version 11 installed
Today we have a windows application that, using an OCX, creates a web page
I have this web application using Spring Web Flow framework. In my main page
I have a page based web method which works fine, using [WebMethod], i.e [WebMethod]

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.