Many-to-many relationship editing


I’ve got a many-to-many relationship. How could I implement an edit page, where user can simple select number of category_name and credit_organization_category will automatically fullfill with necessary data, to connect credit and selected organization_categories.