I can not find the error, error "syntax error, unexpected 'else' (T_ELSE)"

Can someone help me?


<?php
require_once ("config.php");
?>
 
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Cadastro</title>
    <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
 
    <div id="Register">
        <form method="post" action="?go=cadastrar">
            <table id="cad_table">
                <tr>
                    <td>Nome</td>
                    <td><input type="text" name="nome" id="nome" class="txt"></td>
                </tr>
                <tr>
                    <td>Login</td>
                    <td><input type="text" name="login" id="login" class="txt" maxlength="20"></td>
                </tr>
                <tr>
                    <td>Email</td>
                    <td><input type="text" name="email" id="email" class="txt"></td>
                </tr>
                <tr>
                    <td>Senha</td>
                    <td><input type="password" name="senha id="senha" class="txt" maxlength="16"></td>
                </tr>
                <tr>
                    <td colspan="2"><input type="submit" value="Registar" id="btnCad"></td>
                </tr>
            </table>
        </form>
 
    </div>
 
 
</body>
</html>
<?php
if(@_GET['go'] == 'cadastrar'){
    $nome = $_POST['nome'];
    $login = $_POST['login'];
    $email = $_POST['email'];
    $senha = $_POST['senha'];
________________________________________________________________________________________________________________________________
ERROR
    if(empty($nome)){
        echo "<script>alert(Preencha todos os campos!'); history.back();</script>";
    }elseif(empty($email)){
        echo "<script>alert('Preencha todos os campos!'); history.back();</script>";
    }elseif(empty($login)){
        echo "<script>alert('Preencha todos os campos!'); history.back();</script>";
    }elseif(empty($senha)){
        echo "<script>alert('Preencha todos os campos!'); history.back();</script>";
    }else{
        $query1 = mysqli_fetch_row(mysqli_query("SELECT * FROM REGLOG WHERE REGLOG = '$user'"));
        if ($query1 == 1){
            echo "<script>alert('Login ja existe'); history.back();</script>";
        else{
            mysqli_query("insert into reglog (nome, email, login, senha) values ('$nome','$login','$email','$senha')");
            echo "<script>alert('Registrado com sucesso');</script>";
            header("location: cadastro.php")
_______________________________________________________________________________________________________________________________
        }
    }   
}
?>
@_GET['go']

@ instead of $

the error continues

Parentheses failed.

1 Like

thank you, I’ve already managed

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.