Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function verifyRequiredParams($inArray, $requiredColumns) {
$error = false;
$errorColumns = "";
foreach ($requiredColumns as $field) {
if (!isset($inArray[$field]) || strlen(trim($inArray[$field])) <= 0) {
$error = true;
$errorColumns .= $field . ', ';
}
}
if ($error) {
$response = array();
$response["status"] = "error";
$response["message"] = 'Required field(s) ' . rtrim($errorColumns, ', ') . ' is missing or empty';
print_r($response);
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment