Syntax error - URL return

Asked

Viewed 40 times

0

Hello, everybody

I am with a new problem, I am a few hours trying to identify the syntax error below:

Code:

<?php

session_start();

@$usuario = $_SESSION["usuario"];
@$senha = $_SESSION["senha"];

if(isset($usuario) && isset($senha)){

    header("Location: cp_admin.php");
}

?>

<body>
    <main>
        <div id="login">

            <?php 

            if(isset($_GET["url"])){

                $url = $_GET["url"];

            }

            ?>

            <form action="acoes/user-login.php?url=<?php echo $url; ?>" method="POST"> 

            <?php } else { ?>
                <form action="acoes/user-login.php" method="POST"> 
            <?php } ?>    

                Usúario <input type="text" name="user-name" id="user-name" placeholder="USÚARIO" /> 
                Senha <input type="password" name="user-pass" id="user-pass" placeholder="SENHA" />
                <input type="submit" name="user-login" id="user-login" value="Entrar" />
            </form>
        </div>

        <div class="content-logo-2"><img src="../img/android-icon-36x36.png"></div>
        <div id="content-logo"> <!--<img src="../img/logo_180.png"> --></div>
    </main>

The problem is that when I try to access the page to check if the code is working (I know it is not), it returns me the following error:

"Parse error: syntax error, Unexpected '}' in C: Program Files (x86) Easyphp-Devserver-16.1 eds-www Portal_noticias painel index.php on line 74"

row 74 has the following codes:

I wonder what mistake I’m making

I stand by

  • The lines that are in trouble are these: <? php } Else { ? > <form action="acoes/user-login.php" method="POST"> <?php } ?>

1 answer

2


the code:

<?php
if(isset($_GET["url"])){
    $url = $_GET["url"];
}
?>

Try removing the last brackets }, is where the error lies :)

  • Faced with such a simple stop, sometimes it is good to stop and do another day: It looks like this: <?php} Else <form action="acoes/user-login.php" method="POST"> ? > Worked perfectly. Really worth it!

  • @Cíceroalves If you have helped and solved your problem mark my answer as correct, thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.