0
<button class="btt"><a href="carrinho.php?prod=<?= $skins['id_skin']?>">Comprar</a></button>
good i wanted to check if the person really clicked on the button and if the get = cart.
0
<button class="btt"><a href="carrinho.php?prod=<?= $skins['id_skin']?>">Comprar</a></button>
good i wanted to check if the person really clicked on the button and if the get = cart.
-1
The element
<a>
shall not be descended from the<button>
.
You can include one more URL parameter with a value name carrinho
:
carrinho.php?prod=<?=$skins['id_skin']?>&clique=carrinho
In PHP you check if the parameter clique
is equal to carrinho
:
$prod = $_GET['prod'];
$clique = $_GET['clique'];
// $clique igual a "carrinho" e $prod não é vazio
if($clique == "carrinho" && !empty($prod)){
// fazer algo
}
https://jsfiddle.net/cr5aqznd/ mano vc can tell me if I had the right logic?
I created an if to check if there is no session items (which is an array) is pq has no product, otherwise it will add ( pq has already added product).
It looks ok, but it’s good to always test.
Browser other questions tagged php
You are not signed in. Login or sign up in order to post.
The
<a>
can’t be inside a<button>
.– Sam
how would it be then? I wanted to check if the people really clicked the button.
– Felipe
if he clicked the button I would do an if for him to grab the id, and check if there is an item session.
– Felipe
it’s not, I just created the same button.
– Felipe
@sam and how would I check the get? sends an answer so that I can vote for her as a positive bro.
– Felipe