I think your problem is with the values of combobox Vs database. Your saving 1 for bike 2 for car in database. But when you load them at a combobox or selectbox, default index is zero, 0. So your bike (1 in db) will be 0 in combobox. Car (2 in db) will be 1 ou combobox. So when you load combobox and try to edit bike it will show car. Because car índex in combo = 1 (same as bike in db). Usualy you need to sync the combos and selects boxes while retrieving data from database to fill them. Theres a few tricks. Personally myself i use always a array to sync the data. Because arrays also start at zero. So no issues. :).
Sep 6, 2015
3
Level 33
Combo box select value from database
I've two values in my combo box. Car and bicycle when the user selects one of them it will be stored in the database with 1 or 2. But how do I make sure that when the user edits it the chosen values shows up.
For example I've saved bicycle in the database than when the user wants to edit it it must show bicycle and not car!
Please or to participate in this conversation.