// make sure we don't choose a vendor code that has already been taken if (!$obj_vendor->verify_code_vendor()) { log_write("error", "process", "This vendor code is already used for another vendor - please choose a unique code, or leave it blank to recieve an auto-generated value."); $_SESSION["error"]["code_vendor-error"] = 1; } //make sure each contact has a name for ($i = 0; $i < $num_contacts; $i++) { if (!$obj_vendor->verify_name_contact($i)) { log_write("error", "process", "Each contact must be given a name - please ensure each contact has been assigned a unique name"); error_flag_field("contact_" . $i); log_debug("edit-process", "NO NAME ERROR FLAG: contact_" . $i); } } //make sure each contact name is unique for ($i = 0; $i < $num_contacts; $i++) { $uniqueness = $obj_vendor->verify_uniqueness_contact($i); if ($uniqueness != "unique") { log_write("error", "process", "You have assigned the same name to two or more contacts - please choose unique names"); error_flag_field("contact_" . $i); error_flag_field("contact_" . $uniqueness); } } // return to the input page in the event of an error if ($_SESSION["error"]["message"]) { if ($obj_vendor->id) { $_SESSION["error"]["form"]["vendor_view"] = "failed"; header("Location: ../index.php?page=vendors/view.php&id=" . $obj_vendor->id); exit(0); } else { $_SESSION["error"]["form"]["vendor_add"] = "failed"; header("Location: ../index.php?page=vendors/add.php");