function emptyInputSignup($name, $email, $username, $pwd, $pwdrepeat) {
$result;
if (empty($name) || empty($email) || empty($username) || empty($pwd) || empty($pwdrepeat)) {
$result = true;
}
else {
$result = false;
}
return $result;
}
It keeps returning this Undefined variable '$result'. Below is the full error message. I also add an image. [{ "resource": "/c:/xampp/htdocs/FeedCalculator/includes/functions.inc.php", "owner": "generated_diagnostic_collection_name#1", "code": "1008", "severity": 8, "message": "Undefined variable '$result'.", "source": "intelephense", "startLineNumber": 4, "startColumn": 5, "endLineNumber": 4, "endColumn": 12 }]
The code and error as seen in vs
CodePudding user response:
I tried your function and I got a true result. https://onlinephp.io/c/5ffc0
CodePudding user response:
the code looks correct for me (and is working, ive tried it on localhost with PHP8). Which PHP Version are you using?
Maybe try this:
function emptyInputSignup($name, $email, $username, $pwd, $pwdrepeat) {
if (empty($name) || empty($email) || empty($username) || empty($pwd) || empty($pwdrepeat)) {
return true;
}
return false;
}