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.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745576224a4633977.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