I am using **select2** plugin for selection.

I have multiple forms with employee name and three multi selection box for location department and position in each form, where each employee has multiple locations and in each location can have multiple department and position, means department and position are dependent on location with respect to each employee.

Department and position are shown in optgroup for location under which department and position are shown as option

**Problem**

I saved all values to my database.
how to show all selected values of location, department, and position with respect to the employee when I am in edit part.

[![enter image description here](https://i.stack.imgur.com/ibxYa.png)](https://i.stack.imgur.com/ibxYa.png)