if (isset($_POST['customerName']) || isset($_POST['phoneNumber']) || isset($_POST['emailAddress']) || isset($_POST['referral'])) { if ($_POST['customerName'] == "") { $errorMessages['customerNameError'] = 'Please enter a customer name.'; $hasError = true; } if (!is_numeric($_POST['phoneNumber']) || $_POST['phoneNumber'] == "") { $errorMessages['phoneNumberError'] = "Please enter a phone number."; $hasError = true; } if ($_POST['emailAddress'] == "") { $errorMessages['emailAddressError'] = "Please enter a email address."; $hasError = true; } if (!$hasError) { $contact = new ContactInfo("1", $_POST['customerName'], $_POST['phoneNumber'], $_POST['emailAddress'], $_POST['referral']); if ($contactDAO->dupEmail($contact->getEmail())) { echo '<span style=\'color:red\'>This is a duplicate email, please change another email.</span>'; } else { $addSuccess = $contactDAO->addContact($contact); echo '<h3>' . $addSuccess . '</h3>'; } } } if (isset($_POST['btnSubmit'])) { $target_path = "files/"; $target_path = $target_path . basename($_FILES['myfile']['name']); if (move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) { $fileUploaded = "The file " . basename($_FILES['myfile']['name']) . " has been uploaded"; echo "<p>{$fileUploaded}</p>"; } else { echo "There was an error uploading the file, please try again!";