0
Good afternoon, you guys!
I have an application that contains a dropdown
that has the user name and within this dropdown
has a form pro user put your data to login.
This form is directed to a check and after the check, the user is redirected to the main page, however, I would like when the page was loaded, the contents of the dropdown
also changed. Does anyone know how I can do this?
Here’s my form code
<div class="dropdown">
<center> <li style="display: block; width: 100px; margin-right: 10px; margin-left: 40px;"><a style="color: #ccc; text-decoration: none;" href="#"> <img src="images/user.png" width="35px"><br> Sua conta </a></li> </center>
<div class="dropdown-content">
<form name="formLogin" id="formLogin" action="verificaLogin.php" method="post">
<input style="width:250px;" type="email" id="userLogin" name="userLogin" placeholder="Digite seu email">
<br>
<input style="width:250px;" type="password" id="userPassword" name="userPassword" placeholder="Digite sua senha">
<br>
<input type="submit" value="Entrar" id="btnLogar" name="btnLogar" style="width: 100px;">
<a name="recuperaSenha" id="recuperaSenha" href="#"> Esqueci minha senha </a>
<br> <br>
<p style="color: #777"> Ainda não pussui conta? <a style="text-decoration: underline;" name="Cadastro" id="Cadastro" href="#"> Cadastre-se </a>
</p>
</form>
</div>
</div>
[/code]
And this is my verification code
<?php
include 'conectaBanco.php';
include 'loginVO.php';
include 'loginDAO.php';
$login = new loginVO;
$loginDAO = new loginDAO;
$mysqli = new mysqli("localhost", "root", "", "bdPaiDaElo");
if(NULL !== filter_input(INPUT_POST, "btnLogar")){
$login ->setEmailLogin(filter_input(INPUT_POST, "userLogin"));
$login ->setSenhaLogin(filter_input(INPUT_POST, "userPassword"));
if(!$login ->getEmailLogin() || !$login->getSenhaLogin()){
echo "<script> alert('Por favor, verifique se digitou seu email e/ou senha corretamente') </script>";
} else {
if($loginDAO ->selecionaLogin($login)){
session_start();
echo '<script> window.location.replace("index.php"); </script>';
}
}
}
?>
n found the dorpdown q commented and in the verification code vc can redirect in PHP itself instead of printing a JS
– cmnardi
The
dropdown
is in the form code.– Jessy
As for the redirect. I read that
location.replace
prevents the person from returning to the previous page. That’s not it?– Jessy
explains better what you want to change. Theoretically an "if (estaLogado)" solves your problem
– cmnardi
I want to change the content of
dropdown
when the page is redirected on the lineecho '<script> window.location.replace("index.php"); </script>';
– Jessy
@cmnardi Why not answer this way? It may be the same solution.
– Daniel