0

I can not for the life of me figure out why I am getting the above error code. here is my php. 1000 thank yous to whoever can solve this:

<?php

 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;
}

1 Answers1

1

In your code, you're missing the '{' after if(conditions).

brackets are replaced by ':' for the opening and by ';' for closing and we explicitly say 'endif' which allows us to know when the if block closes instead of having a simple '}' as an indicator.

In short, to avoid getting lost with the opening and closing of your ifs in the middle of your HTML code, use this structure instead:

<?php if($condition): ?>
    // CODE HTML if
<?php else: ?>
    // CODE HTML else
<?php endif; ?>
izail
  • 76
  • 2
  • 7
  • If he can forget the `{`, he could also forget the `:`. So this doesn't make the typo any less likely. – Barmar Oct 15 '21 at 01:10