php check if specific input empty code example
Example 1: php check if specific input empty
/*
=============Input Type File=============
*/
$is_uploading = $_FILES["inputfilename"]["error"];
/*
the variable $is_uploading has value either 0 or 4
0 => the user is uploading specific files or images
4 => user is not uploading anything
*/
$can_pass = $is_uploading == 0 ? true : false;
if($can_pass){
echo "You can Pass";
}
else{
echo "Please upload. Your request has empty files.";
}
Example 2: php if input is empty
$a = empty($a) ? "Default value" : $a;