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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:51:35+00:00 2026-05-26T19:51:35+00:00

I have a html table that I am populating with PHP, now it is

  • 0

I have a html table that I am populating with PHP, now it is populated and it has a button called ‘update’, there is also a field per row that has the ‘client_id’, also there are fields that have textboxes.

What I want to do now, is that if the user clicks on ‘Update’, it will post only those values for that row… How can i do this?, when they click ‘Update’ is it going to post all the fields of all the rows?, I just want the row where the update button was clicked.

Code below

print("<table id='results'><tr><th>ID</th><th>Image</th><th>Name</th><th>Price</th><th>Price Label</th><th>Description</th><th>Update</th></tr>");

 while($row2 = mysql_fetch_array( $result2 )){ 
     $client_id = $row2["client_id"];
     $client_name = $row2["client_name"];
     $client_disc = $row2["client_disc"];
     $client_price = $row2["client_price"];
     $client_image = $row2["client_image"];
     $client_price_label = $row2["client_price_label"];

     print("<tr>");   
     print("<td>");
     print("<p style='font-size:14px; color:blue; padding:0;'>$client_id</p>");
     print("</td>");          
     print("<td>");
     print("<img class='custom_rate' alt='' src='$client_image' />");
     print("</td>");
     print("<td width='100px'>");
     print("<input type='text' value='$client_name' name='clientname'/>");
     print("</td>");
     print("<td>");
     print("<input type='text' value='$client_price' name='clientprice'/>");
     print("</td>");
     print("<td width='100px'>");
     print("<input type='text' value='$client_price_label' name='clientpricelabel'/>");
     print("</td>");
     print("<td width='100px'>");
     print("<textarea cols='15' rows='2' name='description'>$client_desc</textarea>");
     print("</td>");
     print("<td width='100px'>");
     print("<input type='submit' value='Update' name='update'/>");
     print("</td>");
     print("</tr>");
}

print("</table>");
  • 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-26T19:51:36+00:00Added an answer on May 26, 2026 at 7:51 pm

    You can make each row a form. However, this is going to be invalid HTML. Though, it’ll still work.

    I’d create some javascript to pull all of the values of the inputs within the row into a single json object, then send that object to the server via ajax.

    jQuery would be my library of choice to do that, unless you have a larger app.

    Hope that helps…

    Updated: provided sample code to submit json for a row…

    <script>
        $(function(){
            $( '.submit_button' ).click(function(){
    
                var form_values = {};
    
                $( this ).closest( 'tr' ).find( 'input, select' ).each(function(){  
                    form_values[ $(this).attr('name') ] = $(this).val();
                });
                if( form_values.undefined ){
                    delete form_values.undefined;
                }
    
                $.post( "/test.php",
                    form_values,
                    function(data){
                        //success
                        alert( data );
                    },
                    "json"
                );
    
            });
        });
    </script>
    

    Update:

    I wasn’t happy with my previous answer, so I created a standalone html file to demonstrate that it works.

    https://gist.github.com/1367465

    You can’t wrap a tag around a , like the others are suggesting, because it’ll break the html of the table.

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

Sidebar

Related Questions

I have an html table that has a name and a radio button like
I have an HTML table that has rows added in a PHP loop. This
I have a HTML file that has code similar to the following. <table> <tr>
I have a HTML table that displays rows of records and has a column
I have an html table that literally has like 30 columns of data, and
I have an html table that is populated from a text file, formatted and
I have an HTML Table that looks like this: The user can update any
I have an html table that pulls data from a DB. It has an
I have a html table that has 2 cells in a row. How can
I have an HTML table that looks like this: ------------------------------------------------- |Column 1 |Column 2

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.