Closed. This question is off-topic. It is not currently accepting answers.admin管理员组文章数量:1431726
Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?
Closed 6 years ago.
Improve this questionI have directly copied the code from a tutorail video that I have been watching and even got a hold of his code files and directly copied and pasted just to make sure but this error keeps popping up. It seems to be limited to this body of
// Checks for a valid email
else
if
{
(!filter_var($email, FILTER_VALIDATE_EMAIL))
{
header("Location: ../signup.php?error=invalidmail&uid=" . $username);
exit();
}
If you have any input on where I went wrong please help, as I am new at this
Closed. This question is off-topic. It is not currently accepting answers.Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?
Closed 6 years ago.
Improve this questionI have directly copied the code from a tutorail video that I have been watching and even got a hold of his code files and directly copied and pasted just to make sure but this error keeps popping up. It seems to be limited to this body of
// Checks for a valid email
else
if
{
(!filter_var($email, FILTER_VALIDATE_EMAIL))
{
header("Location: ../signup.php?error=invalidmail&uid=" . $username);
exit();
}
If you have any input on where I went wrong please help, as I am new at this
Share Improve this question edited Apr 18, 2019 at 10:36 fuxia♦ 107k39 gold badges255 silver badges459 bronze badges asked Apr 18, 2019 at 8:27 John StewardJohn Steward 1 2 |1 Answer
Reset to default 1That code looks completely mangled. Try:
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
header("Location: ../signup.php?error=invalidmail&uid=" . $username);
exit();
}
Count up the if
and else
and make sure they surround the code correctly. Although you can skip the {}
when using a single line of code, it's good practice to always add them in, so you can avoid messy, error prone code like this.
if($value = 10) {
// Your code
} else {
// Something else
}
Finally, this isn't anything to do with WordPress.
本文标签:
版权声明:本文标题:login - Trying to create a log in system but getting error "Parse error: syntax error, unexpected 'else' 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745576224a2664343.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
else
or make itelseif
if it is part of a larger control structure above it. – norman.lol Commented Apr 18, 2019 at 8:34{
afterif
and this is the cause of the error. See the link that gave leymannx. – nmr Commented Apr 18, 2019 at 8:37