I have created a custom post type named company which I need to get some data from another custom post type named people. Specifically, I want to display in the company post type in edit mode a list of people's names with checkboxes that belong to a specific country which is a custom field in people. So I would like to save to a custom field an array of all the names of the people that are checked in the checkboxes. I don't want to do this by having specific custom fields for each person, and I don't want to use any plugins. Just php and wordpress. Below is what I have done so far that displays (and not saves) succesfully a checkbox list with those names. Finally, I am a beginner to wp so be patient :D Any help would be greatly appreciated :D
[Code moderated as per the Forum Rules. Please use the pastebin]