views:

31

answers:

2

Hi, Is it possible for entering values into dropdown and saving that values to DB? If yes please help me by giving the code for that. Thanks in advance

A: 

A dropdown? Like a select form field? It is possible. After the form posts, you can check the values and do sql inserts as you wish. Of course cleaning and validating the data is on you though.

Kevin
Hi Kevin, Let us assume, the dropdown is already populated from Db and it has now 5 items. And i am able to enter text other than the 5 item if it possible, and by clicking save button that new value will be saved to the DB.
Dilse Naaz
You can control the form. Within the select dropdown, you can have dynamic code fill out options, then statically add others. The code that processes the form will insert db values based on the form values.
Kevin
A: 

When a form posts back a drop down list field, I thought that only the selected value was posted back.

If that is the case, how are your values getting into the drop down list? If they are being added client-side, then they won't all make it back to the server.

Paul Lucas