Data inserting to database from table

I write acode that take input from input field (admissionNumber,course_name,midresult and finalresult) andwhen add button clicked to compute sum for midresult and finalresult and store it in total mark variable in javascript and compute total sum of all courses totalmark and average for alladmissionNumber and display in table form. I need to store the whole result details in database table called tblresult having admissionNumber,course_name,midresult, finalresult and total mark.

I tried to store as usual but when ad button is clicked the input fields are cleand exept the admissionNumber which is what i needed but i expected to insert into tblresult not from input fiel instead from the table which is created by java script dynamically