Dynamically Add rows to a Commission Copy' HTML Table finally INSERT INTO mysql all the table content

Hello to everybody
What a long subject

Actually this is a many hints with tips request

Subject in detail: a commission copy, formerly an order copy, is a module where you write (insert) item that are ordered to some supplier.
Each item has some columns
Quantity, article code (if any), article name, price (if any)

In one order the item can be just one, but in another they could be many items (rows)

So the ideal input page/form is made by an HTML table where the cells will act as input text(s)

So a button is needed. Add new row. While when opening the New Order Page, it will be prompted the table with just one row. If a new row is needed, Add New Row button will append one row to the table

When the order is filled and complete we have n rows, the requirement is to INSERT INTO the order_details MySQL table all the HTML Table row’s cells content

I think that AJAX will help so much in this case, because a plus is to have a checkbox in an additional cell at the end or at the begin of each row, let’s call it “action”, that would b associated with two buttons “Remove” to delete the row (if needed) and “Edit” if something is wrong.

I have seen plenty of questions and tutorials on this topic, either one on sitepoint
How to insert the dynamic table row values into mysql database when checking the checkbox in jquery (unfortunately after 90 days it got closed)

Well since coding allows many paths , each with pros and cons, I kindly ask your point of view on the best manner of how to set up this page and table.

Hopefully this is not too broad so let’s limit the question.

The table for the example will be just with 4 columns
ColA - ColB - ColC - ColD

And the rows will still be n, since loops through some array, sounds sharp will happen.

Thank you for reading and thank you even more for any of your suggestions and opinions or either links to stuff like this


If something is not clear I can restrict the range and provide more details

Thank you for any suggestion

The best way to approach this problem is to first code it up with no JavaScript at all. That way you will have all of the scaffolding that you need, and when JavaScript is then used to improve the user experience, it will continue to work even if JavaScript has problem.

Everyone has JavaScript, right?

Making it work normally without JavaScript involves using server-side code to process the form requests (such as add row), and the server-side code then gives a new page with the updated form layout.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.