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

The Archive Base Latest Questions

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

I am building an application which has a dynamic table, everytime you open the

  • 0

I am building an application which has a dynamic table, everytime you open the page table`s row and columns changes based on data in database.
Each Row is a vendor company each colomn is a Item Title. All these vendors upply the same item, So this table has a textbox in each contains a TextBox so user can type the value, which represents the amount of fruit they want from that supplier. the following is the example.

Example Data

So what I need to do now is, after entering these values, I’d like to process them through PHP, and then see 4 different reports at the confirm page, example: write the Company name and under that, what they have to supply for each item, then the next company, so on and so forth to the end.

I don’t know if i should create different class for each textbox? or ID them!! SHould I Array them? I am confused.. If any of you guys can help, would be wonderful

Thanks a lot

  • 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:21:43+00:00Added an answer on June 9, 2026 at 2:21 pm

    I would suggest you just name the input elements as an array. something like:

    <input type="text" name="fruits[company1][apple]">
    <input type="text" name="fruits[company1][berries]">
    <input type="text" name="fruits[company1][orange]">
    <input type="text" name="fruits[company1][bannana]">
    
    <input type="text" name="fruits[company2][apple]">
    <input type="text" name="fruits[company2][berries]">
    <input type="text" name="fruits[company2][orange]">
    <input type="text" name="fruits[company2][bannana]">
    

    or the same thing with the fruit being the first level and company name being second. It is really the same thing and generally just as easy to use either one. Just depends on how you want to loop over the data once you post the form. You might be better off also using ids for the company name and/or the fruit. Just makes it so, for example, company names with a space are still valid.

    Using the above form, you can process the data with something like this:

    <?php
    foreach($_POST['fruits'] as $company=>$row){
        foreach($row as $fruit=>$quantity){
            if(!is_numeric($quantity) || $quantity < 0){
                $quantity = 0;
            }
            echo "You selected {$quantity} {$fruit} from {$company}";
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building view based application,which has many pages an in every page ther
I'm building an enterprise application which has fraud rules. The rules will be based
I'm building an Iphone application, which has to retrieve information from a database on
I am building an application in cold fusion which has a SQL Server database
I am building an application which has a database with two tables created internally
I am building an application, which has an application based front-end in C++/Qt and
I'm looking for some opinions here, I'm building a web application which has the
I'm building an android application, which has a list view, and in the list
I am building an application which stores GPS locations in a SQLite database and
I am building a Monotouch application which downloads data from the server encrypted using

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.