Dynamic Insert statement

I have a form , where i will put the values to a table.

I wrote a insert statement for the same.
Table structure is
ename | character varying(30) |
eadd | character varying(30) |
eid | integer |
sal | integer

In the statements, i don't want to write all the column names and values. i mean
INSERT INTO emp (ename,eadd, eid,sal) VALUES (?,?,?,?);
i gave something in the last column i.e sal, then my sql statement should look like.

INSERT INTO emp (sal) values(that given in the form);

The Code should be dynamic. If we will fill 3 fields in the form then code should be
INSERT INTO tablename(col1,col2,col3) VALUES (val1,val2,val3);

Assuming these values are coming from a web form, you can refer to the fields via the name attribute or id attribute of the fields they refer to? In other words, a solution to your issue is only possible if there is a mapping between the semantics of your input data and the structure of your table.