Store Multiple Checkbox Values From Other Table

Hello. I’m trying to save multiple checkbox values (from rooms(id)) to authorization(rooms_ids) in one sql records. Details are below:

I have 3 models:

authorization(id, authorization_number, employee_id, authorization_date, rooms_ids)

rooms(id, number, name)

employee(id, surname, firstname)

Every employee can have many authorizations. Important think is that rooms_ids must be assigned to authorization id. I don’t want to store rooms names as textfield in authorization table. I want to store rooms_id, which will be displayed as checkbox from rooms table. Is this a good solution? I don’t know how to save multiple checkbox values in one sql record. Can anyone help me? Many thanks

Tom:)

see this link

http://www.bsourcecode.com/2013/03/yii-chtml-checkboxlist.html