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 9060851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:20:18+00:00 2026-06-16T15:20:18+00:00

How can I collect the data on the row from the table that I

  • 0

How can I collect the data on the row from the table that I select and use it in the result?

Here is the javascript I am using to show the data entry screen, once the function has been called by selecting the row. Now I just need to design a form in PHP that will include (1) some of the data from the row selected and (2) some new data that will be collected.

Here is the Javascript to select the row and call the data entry form

$(document).ready(function () {
    $("tr").live('click',function(){
        $.post('data_entry_form.php', function(data) {
            $('#section2').html(data);
        });
    });
});

Here is the PHP Script

<?php
require_once "config.php";
$dbh = new PDO($dsn, $dbuser, $dbpass);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);

$result = $dbh->query("SELECT aif_id, fee_source_id, company_name_per_sedar, document_filing_date FROM a_aif ORDER BY aif_id DESC");
$result->setFetchMode(PDO::FETCH_ASSOC);

echo "<table id=\"all_aifs\">";
echo "<tr>";
echo "<th><b>Document ID</b></th>";
echo "<th><b>Pubco Name</b></th>";
echo "<th><b>Filing Date</b></th>";
echo "<th><b>PDF</b></th>";
echo "</tr>";

foreach($result as $index => $row) {
echo "<tr>";
echo "<td>$row[fee_source_id]</td>";
echo "<td>$row[company_name_per_sedar]</td>";
echo "<td>$row[document_filing_date]</td>";
echo "<td>Placeholder</td>";
echo "</tr>";
}

echo "</table>";
echo "<br>";
$dbh = NULL;
?>
  • 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-16T15:20:19+00:00Added an answer on June 16, 2026 at 3:20 pm

    The “Correct” answer to this problem is NOT to read from the DOM. Never a good idea. I suggest you pass the record id to the ajax call and have the ajax call return an already-populated form.

    //PHP
    //place the data attribute in the tr
    echo "<tr data-recordId='".$row['id']."'>";
    
    
    //JS
    $(document).ready(function () {
        $("tr").live('click',function(){
    
            //Get the ID from the row clicked
            var id = $(this).data('recordId'); 
    
            //short-hand
            $('#section2').load('data_entry_form.php?id='+id);
    
        });
    });
    

    Then your ajax page would just read $_REQUEST['id'] to get the id of the form being edited.

    //Ajax side PHP
    $id = (int)$_REQUEST['id'];
    //Fetch data and use it to pre-populate form item
    

    You would pre-populate your inputs like this

    <input type="text" value="<?php  echo $row['value']; ?>" />
    

    or

    echo '<input type="text" value="'.$row['value'].'" />';
    

    NOTE: If your values contain quotes, you will want to replace them with the code &quot;

    echo '<input type="text" value="'.str_replace('"', '&quot;', $row['value']).'" />';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use ExecuteReader with CommandBehavior to collect data from an SQL table
I am creating an ASPX application that collects data from the user can creates
I am using iostream to collect data from a device.First I Write file in
i have export a excel sheet which will collect data from my customer table
Can we change the default action of the edit selected row button? Here is
Lets assume a device that can give n signals at random times. We collect
my target is it to collect data from clients which send data to an
We're writing software for child sponsorship organizations that need to collect data in remote
I ask this because I am creating a spider to collect data from blogger.com
I can filter data from the Web-Application itself, but isn't there a way to

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.