-1
I am with several error msg of : Dryness Notice: Undefined index:
basically in my login system when not logged in this error appears in shopping cart qnd has no product appears this error.
(When you have a product in the cart( no error appears, pq has data in mysql table) (When I am logged in to the site also no error appears.)
code:
<div id="logobuscar">
<div id="wrapperlogo">
<div id="logo"><img src="images/logosecure.png" alt="SecureStore" height="120" width="120"></div>
<div id="buscar"> <?php
$sessao = $_SESSION['pedido'];
$consulta = $pdo->prepare("SELECT * FROM carrinho_temporario WHERE temporario_sessao =:ses");
$consulta -> bindValue(':ses', $sessao);
$consulta -> execute();
$linhas = $consulta -> rowCount();
?>
<p class="text-right "><a href="carrinho.php" class="color-white bgcolor-red font-text-light font-weight-heavy car_show">Carrinho(<?= $linhas ?>)</a></p><br>
</form></div>
</div>
</div>
<?php
if ($_SESSION['logged_in'] != true){
?>
<form action="login.php" method="post">
<label for="email">Email: </label>
<br>
<input type="text" name="email" id="email">
<br><br>
<label for="password">Senha: </label>
<br>
<input type="password" name="password" id="password">
<br><br>
<input type="submit" value="Entrar">
</form>
</div>
<?php
}
?>
i already started bro, he can access the good problem is when there is nothing in mysql appears this error: If I add 1 item to the cart it disappears, and log in the login problem also some.
– Ming
I edited the answer for you, to see if it fits. put the count of rows returned from mysql.
– Luis Alberto Batista
opa mano I think this is helpful, but I think the problem is in this request because it gave this error: Notice: Undefined index: pedido in C: xampp htdocs skincs logar.php on line 2
– Ming
See the modification in the answer relative to $_SESSION['logged_in'], which was being checked so that if it did not exist, it would return error.
– Luis Alberto Batista
you’re the dude dude mds kkkkkkkkkkkkkkkkkkkkk
– Ming
I’ve been racking my brain for such a simple business since yesterday ...'
– Ming
That’s normal buddy, we’ve all suffered a lot one day! Hug and good walk in the code!
– Luis Alberto Batista
if you use a similar logic in $sessao = $_SESSION['request']; it would work?
– Ming
Yeah, sure, that’s the best way I know to test sessions. Dig deep!
– Luis Alberto Batista
if ($_SESSION['logged_in'] != true){ echo '<a href="log in.php"><li>Login</li></a>'; }Else{ echo $_SESSION['user_name']; } ?>
– Ming
Could you help me with this? When you are not logged in, Undefined appears for the username and I am not being able to use this logic on it.
– Ming
The same name you give to the name in the html input, you recover in the post $_POST["input name here"], then do the isset bid to know if it exists, or ! isset to know if there is no.
– Luis Alberto Batista
have you send the code? I did not understand mt well kk.
– Ming
I’m mounting something here, but watch out because you have no username in the code shown here, and yes email and it is it that you recover there in php. Keep testing while I do it.
– Luis Alberto Batista
Let’s go continue this discussion in chat.
– Luis Alberto Batista