Hi All,
I've got a form that pulls data from a MySQL database and populates the form and allows the user to edit the info and submit the changes to the database. All works fine when I'm working with straight text boxes (which comprises the majority of the form). The problem arises when I'm dealing drop-down select boxes.
Essentially, what I want to do is to populate the drop-down with all choices but have the one "selected" that was previously in the database.
The MySQL tables look like this:
leave_type TABLE which has leave_type_id and leave_type_name
absence_actions TABLE which has absence_id, personnel_id, leave_type_id, etc...
So, I'm looking at grabbing all of the results of the leave_type table to populate the dropdown and then grabbing a specific row from the absence_actions table and making the dropdown "selected" based on the leave_type_id from both tables.
Does anyone have any idea on how to code something like this. This seems like a common problem but I can't find anything on google. Perhaps I don't know how to phrase my query.
Any help is much appreciated.
Thanks,
Scott