Help me with code for sales order in which one can add multiple item and can store it in database. Example.

item name | item rate | item quantity| total amount|
LEd 2100 2 4200 |Edit|Delete (line 1)
Mouse 100 4 400 |Edit|Delete (line 2)
Item list | auto fill | manual | Auto fill | Add (line 3)

Grand Total | 4400 |

Item list is taken from databse. item rate should be come auto as specified in database and total amount should come automatically. after pressing add button next line come automatically as line 3 and the added line must look like line 1 and line 2 with edit and delete option. after submitting the form all entry inserted into database.

Help will be highly appreciated.