I have a wishlist that kinda acts like a cart. I have several categories for the products. Each category at first has a button that says +ADD. Goes to next page to products, user finds and selects that item +ADD to add to previous page which starts a session like cart and changes the category +ADD button to the products info. When I try to do another category and add a product that works too. But, when I remove a product and there isn't anything in 1 category the +ADD is supposed to show up again but doesn't and now im not able to select to do another product add to the wishlist. Should I use javascript instead to show and hide based on the session variables the exist in the array? Or what's the best way? Thank you for any help.
<?php
if (!isset($_SESSION['buildList']) || empty($_SESSION['buildList'])) {
?>
//This normally shows if no session exists or if session exists but empty
// +ADD link button
<td class="add-component">
<a href="content.php?PartType=Part1" class="add-btn"><i class="fas fa-plus"></i>ADD</a>
</td>
//If part has been added into session['buildList'] then replace +ADD link button with this
<?php
}else{
foreach($_SESSION['buildList'] as $product) :
if ($product['PartType'] == 'Part1') {
?>
<a href="pageContent.php?id=<?php echo $product['id'];?>"><img class="p-img" src="<?php echo $product['Image_thumb'];?>"/></a>
</td>
<td class="td-manufacturer">
<h6>MANUFACTURER</h6>
<p>
<?php
echo $product["Manufacturer"];
?>
</p>
</td>
<td class="td-addComponent">
<p>
<?php
echo $product["Price"];
?>
</p>
</td>
<td class="td-material">
<h6>MATERIAL</h6>
<p>
<?php
echo $product["Material"];
?>
</p>
</td>
<?php
}
endforeach;
}
?>