Hi I am looking for someone to answer what is probably an easy question.
At the moment I have two tables "procedures" and "Job Roles", the idea is that I want to be able to create a child table that links which procedures apply to which job roles. At the moment this is done with two tables, by creating a record in the procedure table and then creating subsequent child records in a table called "procedures_jobtitles" which is just a one to many link table.
I am exploring the idea of having a field in the procedures table that is called "applies to", which would be a drop down box presented as check boxes, the idea is that when i create a procedure, on the add/edit page there is a separate tab where this field is displayed, this would display all job roles, so that the user could just tick the ones that apply.
My problem is by doing it this way the field value is stored as (1,2,5,10,11,12) where those numbers represent foreign keys to the job descriptions table. What I would like is to take the "applies to" field and turn it into an array and extract each value that is separated by a comma, so for the above example it would give me a result of:
1
2
5
10
11
12
I can then run a foreach query and insert these records into the link table by an event after saving. The idea behind this is if you have 1 or 2 job descriptions, manually adding to the child table isnt a problem, however when you have 20 or so job titles it becomes much more time consuming. Ive tried hitting google for this, but im afraid my basic understanding of arrays is limited so I dont know what to look for.
Any help using example fields ive given, would be much appreciated