if (isset($_POST['contactinfoid'])) { $contactinfoid = $_POST['contactinfoid']; } foreach ($contactinfo as $key => $cinfo) { $ctype = $contacttype[$key]; $cid = ''; if (isset($contactinfoid[$key])) { $cid = $contactinfoid[$key]; } if (empty($cid) && (empty($ctype) || empty($cinfo))) { continue 1; } try { if (empty($cid)) { $contact = new ContactInfo(); $contact->setProperty('dataowneruserid', $dataowneruserid); $contact->setProperty('locationid', $locationid); } else { if (empty($cinfo)) { ContactInfo::deleteInfo($cid, $userid); continue 1; } $contact = ContactInfo::get($cid, $userid); } $contact->setProperty('contacttype', $ctype); $contact->setProperty('contactinfo', $cinfo, $ctype); $contact->setProperty('datachangebyuserid', $userid); $contact->save(); } catch (Exception $e) { $errormessage = $e->getMessage(); trigger_error($errormessage, E_USER_WARNING);