I am facing an issue where I need to figure out how to add information to a new page when a button is clicked. For example, let's say I have an "add to cart" button and upon clicking it, I want to store some data. How can I achieve this functionality? I am looking for a way to dynamically add information upon the click of a button, but I am unsure of how to implement it. If the add to cart button isn't functioning properly, how can I still make sure that data is stored on click?
.products .box-container {
display: flex;
flex-wrap: wrap;
gap: 1.5rem;
}
.products .box-container .box {
flex: 1 1 30rem;
box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .1);
border-radius: .5rem;
border: .1rem solid rgba(0, 0, 0, .1);
position: relative;
}
.products .box-container .box .discount {
position: absolute;
top: 1rem;
left: 1rem;
padding: .7rem 1rem;
font-size: 2rem;
color: var(--pink);
background: rgba(255, 51, 153, .05);
z-index: 1;
border-radius: .5rem;
}
.products .box-container .box .image {
position: relative;
text-align: center;
padding-top: 2rem;
overflow: hidden;
}
.products .box-container .box .image img {
height: 25rem;
}
.products .box-container .box:hover .image img {
transform: scale(1.1);
}
.products .box-container .box .image .icons {
position: absolute;
bottom: -7rem;
left: 0;
right: 0;
display: flex;
}
.products .box-container .box:hover .image .icons {
bottom: 0;
}
.products .box-container .box .image .icons a {
height: 5rem;
line-height: 5rem;
font-size: 2rem;
width: 50%;
background: var(--pink);
color: #fff;
}
.products .box-container .box .image .icons .cart-btn {
border-left: .1rem solid #fff7;
border-right: .1rem solid #fff7;
width: 100%;
}
.products .box-container .box .image .icons a:hover {
background: #333;
}
.products .box-container .box .content {
padding: 2rem;
text-align: center;
}
.products .box-container .box .content h3 {
font-size: 2.5rem;
color: #333;
}
.products .box-container .box .content .price {
font-size: 2.5rem;
color: var(--pink);
font-weight: bolder;
padding-top: 1rem;
}
.products .box-container .box .content .price span {
font-size: 1.5rem;
color: #999;
font-weight: lighter;
text-decoration: line-through;
}
<div class="box">
<span class="discount">-18%</span>
<div class="image">
<img src="OnyCostopProSpray%2036.90.png" alt="">
<div class="icons">
<a href="#" class="fas fa-heart"></a>
<a href="#" class="cart-btn">add to cart</a>
<a href="#" class="fas fa-share"></a>
</div>
</div>
<div class="content">
<h3>Costop Pro Spray</h3>
<div class="price"> 26.90€ <span>31.74€</span> </div>
</div>
</div>
If anyone could provide assistance with this, I would greatly appreciate it!