如何使用jAutoCalc插件将多行动态表转换为Mysql数据库

I have a dynamic table in an with jAutoCalc plugin to calculate values in each row as well as the total value of all the rows. Can somebody share the code to insertion of each dynamic row to a Mysql database? I am inserting a picture of my table Demo Table

here in each row the theory and practical marks added automatically; and the subtotal and total also calculated automatically. But I have not been able to send all the rows to Mysql database. The calculation part is done with jAutoCalc plugin.

here is my table format:

<table name="cart">
                <tr>
                    <th></th>
                    <th>Name</th>
                    <th>Theory</th>
                    <th>Practical</th>
                    <th>Item Total</th>
                </tr>
                <tr name="line_items">
                    <td><button name="remove">Remove</button></td>
                    <td><select name="subject_name">
                            <option value="Eco">Eco</option>
                            <option value="Eng">Eng</option>
                        </select></td>
                    <td><input type="text" name="subject_theory" value="1"></td>
                    <td><input type="text" name="subject_practical" value="9"></td>
                    <td><input type="text" name="subject_total" value="" jAutoCalc="{subject_theory} + {subject_practical}"></td>
                </tr>


                <tr>
                    <td colspan="3">&nbsp;</td>
                    <td>Subtotal</td>
                    <td>&nbsp;</td>
                    <td><input type="text" name="sub_total" value="" jAutoCalc="SUM({subject_total})"></td>
                </tr>

                <tr>
                    <td colspan="3">&nbsp;</td>
                    <td>Total</td>
                    <td>&nbsp;</td>
                    <td><input type="text" name="grand_total" value="" jAutoCalc="{sub_total}"></td>
                </tr>
                <tr>
                    <td colspan="99"><button name="add">Add Row</button></td>
                    <td colspan="99"><button name="submit">Submit</button></td>
                </tr>
            </table>

here is jquery that I used for dynamic generation of rows:

<script type="text/javascript">

            $(document).ready(function() {

                function autoCalcSetup() {
                    $('form[name=cart]').jAutoCalc('destroy');
                    $('form[name=cart] tr[name=line_items]').jAutoCalc({keyEventsFire: true, decimalPlaces: 0, emptyAsZero: true});
                    $('form[name=cart]').jAutoCalc({decimalPlaces: 0});
                }
                autoCalcSetup();


                $('button[name=remove]').click(function(e) {
                    e.preventDefault();

                    var form = $(this).parents('form')
                    $(this).parents('tr').remove();
                    autoCalcSetup();

                });

                $('button[name=add]').click(function(e) {
                    e.preventDefault();

                    var $table = $(this).parents('table');
                    var $top = $table.find('tr[name=line_items]').last();
                    var $new = $top.clone(true);

                    $new.jAutoCalc('destroy');
                    $new.insertAfter($top);
                    $new.find('input[type=text]').val('');
                    autoCalcSetup();

                });

            });

        </script>

Here, I have created a table for you with 5 columns as below, the Total field can't be possible as that value is going to calculate on a group of rows. So you can calculate that value while selecting the data from the table as I explained below step-by-step.

So, here all you need to insert the values into, "student_id", "name", "theory", "practical" fields, i.e. 4 fields and 5th column will be calculated by the database itself.

mysql> create table mark_obtains(
    -> student_id int,
    -> name varchar(30) not null,
    -> theory int default 0,
    -> practical int default 0,
    -> item_total int GENERATED ALWAYS AS (theory+practical) VIRTUAL
    -> );
Query OK, 0 rows affected (0.39 sec)

mysql> insert into mark_obtains(student_id,name,theory,practical) values (1,'asd',5,6);
Query OK, 1 row affected (0.04 sec)

mysql> select * from mark_obtains;
+------------+------+--------+-----------+------------+
| student_id | name | theory | practical | item_total |
+------------+------+--------+-----------+------------+
|          1 | asd  |      5 |         6 |         11 |
+------------+------+--------+-----------+------------+
1 row in set (0.00 sec)