I'm making an online store and I'm having trouble making the cart, when I click on the icon to add to the cart, it does not matter and the cart is always empty.
Andtheresult:
Thisisthebuttoncode
include ("db.php");
$molcomp_query="SELECT * FROM stock_comp WHERE (diametroaco BETWEEN '$d1' and '$d2') AND (comprimentototal BETWEEN '$comp1' AND '$comp2') AND (diametroexterior BETWEEN '$de1' AND '$de2') $ordenar_por";
$run_query = mysqli_query($con,$molcomp_query);
if (mysqli_num_rows($run_query) > 0){
foreach($run_query as $row){
//while($row = mysqli_fetch_array($run_query)){
$id_mol_comp=$row['id_mol_comp'];
$referencia=$row['referencia'];
$diametroaco=$row['diametroaco'];
$comprimentototal=$row['comprimentototal'];
$diametroexterior=$row['diametroexterior'];
$passo=$row['passo'];
$preco=$row['preco'];
echo
"<div class='card mx-auto w-100'>
<div class='card-body'>
<div class='row'>
<div class='col-md-1' style='text-align: center'>$referencia</div>
<div class='col-md-2' style='text-align: center'>$diametroaco</div>
<div class='col-md-2' style='text-align: center'>$comprimentototal</div>
<div class='col-md-2' style='text-align: center'>$diametroexterior</div>
<div class='col-md-1' style='text-align: center'>$passo</div>
<div class='col-md-1' style='text-align: center'>$preco €</div>
<div class='col-md-2' style='text-align: center'><i style='font-size:30px' class='fa'></i>      
<a class='fa fa-cart-plus' style='font-size:30px' href='carrinho.php?add=carrinho&id= '".$row['id_mol_comp']."'></a> </div>
</div>
</div>
</div>
";
}
}