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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:17:09+00:00 2026-06-02T04:17:09+00:00

I have a jQuery function to dynamically add rows containing input fields, this exists

  • 0

I have a jQuery function to dynamically add rows containing input fields, this exists on a form, the function adds text boxes (distinct names) to each cell in the table

an example of the generated HTML would be:

<table width="400" border="0" cellspacing="0" cellpadding="2px" margin="0" >
    <tbody>
    <tr>
        <td><input type="text" name="name_1"></td>
        <td><input type="text" name="surname_1"></td>
        <td><input type="text" name="age_1"></td>
    </tr>
    <tr>
        <td><input type="text" name="name_2"></td>
        <td><input type="text" name="surname_2"></td>
        <td><input type="text" name="age_2"></td>
    </tr>
    <tr>
        <td><input type="text" name="name_3"></td>
        <td><input type="text" name="surname_3"></td>
        <td><input type="text" name="age_3"></td>
    </tr>
    </tbody>

I am reading the “$_POST[‘varName’] data with the following code:

<?php
    $cnt = 1 ;
    $fName = ( $name ."_" .$cnt) ;
    do {
        echo("$_POST[$fName]  <br>");
        $cnt = $cnt +1 ; 
        $fName = ( $fldName ."_" .$cnt) ;

        } while (isset($_POST[$fName]));
    ?>

however, i would like to simply loop through each row in the table and read the data sequentially in a loop (using PHP), my idea is to pass the table object to a php function, is this possible?

Basically i am looking for a solution to read the table data, where each row contains input boxes “name_X”, “surname_x” and “age_x” and i will not know how many rows exist at design time… (i will never have more than 9 rows)

Hope this is clear!
… Any Suggestions?

  • 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-02T04:17:11+00:00Added an answer on June 2, 2026 at 4:17 am

    You could use a hidden field and set there the number of rows as value using javascript.
    In the php script you can then use a simple for loop.

    Simething like this:

    $rowCount = $_POST['hiddenName'];
    for($i=1; i<=$rowCount; $i++)
    {
    
      $_POST['name_'.$i]
      ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with multiple rows of text boxes. I use jquery .show()
I have a table which has a button to Add Rows. This button adds
I have a script which dynamically adds rows to a form with default values:
I'm using jQuery to let users dynamically add and remove form fields, but it's
I have an RMA form that I've been able to add fields dynamically, but
I have been researching the JQuery way to add table rows dynamically. One excellent
I would like to dynamically add fields to an ASP.NET MVC form with JQuery.
I have a form where the user can dynamically add fields (clone and increasing
Here's the story... I have a jQuery function that does something, this function is
I have the following jquery function > <script type=text/javascript> > > $(document).ready(function() { >

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.