Insert multiselect values into separate rows in a table

I have tables with a similar structure as above. How do I use a multi-select component to insert values into the postcategory table in separate rows but maintain the post id in all rows?

Just linking the duplicate question from here!