public function create_tags($this_id) { if (!isset($_POST['tags'])) { return; } $tag_model = new TagsModel(); $tag_model->clear_tags_for_event($this_id); $tag_names = explode(',', $_POST['tags']); foreach ($tag_names as $tag) { $tag_model->assign_tag_to_event($tag, $this_id); } }