how could I check if the person clicked a button [closed]

0
<button class="btt"><a href="carrinho.php?prod=<?= $skins['id_skin']?>">Comprar</a></button>

Well I wanted to check if the person actually clicked on the button and if the get = cart.

    
asked by anonymous 27.09.2018 / 18:45

1 answer

-1
  

The <a> element can not be descended from the <button> element.

You can include one more URL parameter with a value name carrinho :

carrinho.php?prod=<?=$skins['id_skin']?>&clique=carrinho

In PHP you check whether the clique parameter 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
}
    
27.09.2018 / 19:25