Quote:
How to remove parse error: syntax error, unexpected 'else' (T_ELSE), expecting end of file in C:\xampp\htdocs\ma.php on line 10
Make sure anything match, even after changes in question;
There is no 'else' on line 10.
Learn to indent properly your code, it show its structure and it helps reading and understanding. It also helps spotting structures mistakes.
<?php
$emailErr = " ";
$email = " ";
$errors = 0;
if ($_SERVER ["REQUEST_METHOD"] == "POST")
{
if (empty($_POST ["email"]))
{
$emailErr = "Email is required";
$errors = 1;
}
else
{
$email = test_input ($_POST ["email"]);
if (!filter_var ($email , FILTER_VALIDATE_EMAIL))
{
$emailErr = "invalid format";
$errors = 1;
}
}
}
?>
Professional programmer's editors have this feature and others ones such as parenthesis matching and syntax highlighting.
Notepad++ Home[
^]
ultraedit[
^]