$profile['industries'] = $industries; } $response = array('profile' => $profile); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'update_profile') { $recommender = new Recommender($_POST['id']); $data = array(); $data['firstname'] = sanitize($_POST['firstname']); $data['lastname'] = sanitize($_POST['lastname']); $data['phone_num'] = $_POST['phone_num']; $data['remarks'] = sanitize($_POST['remarks']); $data['region'] = sanitize($_POST['region']); if (!$recommender->update($data)) { echo '-1'; // failed to update new recommender exit; } // update the industries $query = "DELETE FROM recommender_industries WHERE recommender = '" . $_POST['id'] . "'"; $mysqli = Database::connect(); $mysqli->execute($query); if ($_POST['industries'] != '0') { $industries = explode(',', $_POST['industries']); if (!$recommender->add_to_industries($industries)) { echo '-2'; // failed to update industries exit; }