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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:39:04+00:00 2026-06-09T14:39:04+00:00

I need help figuring out how to submit data from a table row into

  • 0

I need help figuring out how to submit data from a table row into PHP to be processed. I would need it to be able to submit multiple rows of data. Any ideas?

I have a table here. I want to be able to check the row and submit the data to php to process the data. It is an HTML table. I just want to know how to pass the variables to php, e.g. an array or something

Ok guys something like this:

$("submit_btn").click(function () {

       $('#diary tbody>tr input:checked').each(function() {
           $.post('process.php', 
                data: "an array",
                success: "data submitted");
       }

});

How would I get the table row data in an array to submit it? (Answer is below)

Ok Part 2:

Sending the table row data to php.

jQuery code:

    rows = JSON.stringify(rows); // submit this using $.post(...)
    alert(rows);
    $.post('classes/process.php', rows, function(data) {
      $('#results').html(data);
    })
        .error(function() { alert("error"); })
    });

PHP Code:

<?php

$rowsArray = json_decode($_POST['rows']);

echo $rowsArray;
?>

Error:

Notice: Undefined index: rows in C:\...\classes\process.php on line 6
  • 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-09T14:39:06+00:00Added an answer on June 9, 2026 at 2:39 pm
    $('#submit_btn').click(function(){
        var rows = [];
        $('#box-table-a tbody tr input[type=checkbox]:checked').each(function(i,v){
            var tds = $(v).parents('tr').children('td');
            rows.push({
                'name': tds.eq(1).find('select').val(),
                'units': tds.eq(2).text(),
                'calories': tds.eq(3).text(),
                'sugar': tds.eq(4).text()
            });
        });
        rows = JSON.stringify(rows); // submit this using $.post(...)
        $.post('classes/process.php', {'rows': rows}, function(data){
            console.log(data);
        });
    });
    

    submit rows using a $.post() and then, in the server side, you can convert back into an array using json_decode();

    Sample output:

    [{“name”:”Water”,”units”:”1″,”calories”:”2″,”sugar”:”3″},{“name”:”Food”,”units”:”4″,”calories”:”5″,”sugar”:”6″}]

    Demo:
    http://jsfiddle.net/cp6ne/84/

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

Sidebar

Related Questions

I need help figuring out how to convert data that comes in from a
I need some help figuring out how I should do this. I would like
I need help figuring out how to display the contents of an NSArray into
Need help figuring out how to extract text from context (Honda from str), need
Need help figuring out a couple common workflows with Github. I come from a
I need help figuring out these php print (echo) statements and where to place
I need help figuring out why my rspec tests are running slowly. I am
I need a little help figuring out what the following URL rewrite rule means.
I know I'm close to figuring this out but need a little help. What
I need help figuring out how to change out the view in my application.

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.