Skip to content

Instantly share code, notes, and snippets.

@OrangeTux
Forked from anonymous/funtion
Last active December 24, 2015 07:29
Show Gist options
  • Save OrangeTux/6764343 to your computer and use it in GitHub Desktop.
Save OrangeTux/6764343 to your computer and use it in GitHub Desktop.
function checkEmpty ($item, $errormessage, &$error){
if (!empty($_POST[$item])){
$name = $_POST[$item];
}
else{
$error[] = $errormessage;
}
}
# Initialize empty array.
$errorstack = array();
# Call checkEmpty with as 3th parameter $errorstack.
checkEmpty('name', "Je hebt je naam niet ingevuld", $errorstack);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment