Trying to show divs and elements when a session doesn't exist. But when I save an item to a cart/wish-list a session starts and goes back to a page that is now supposed to show the item info and hide <td id="cartHideBtn">...</td>.
//shows when no session exists, but also needs to show again if user removes item from cart/wish-list, or show when another part is added
//in a different category
<td id="cartHideBtn" class="add-component">
<a href="content.php?PartType=UpperReceiver" class="add-btn"><i class="fas fa-plus"></i>ADD</a>
</td>
If session exists and a product is added then display this.
<?php
if (isset($_SESSION['buildList'])) {
foreach ($_SESSION['buildList'] as $product) :
if ($product['PartType'] == 'UPPER RECEIVER') {
?>
<tr>
<td>
<a href="pageContent.php?id=<?php echo $product['id'];?>"><img class="p-img" src="<?php echo $product['Image_thumb'];?>"/></a>
</td>
<td>
<h6>MANUFACTURER</h6>
<p>
<?php
echo $product["Manufacturer"];
?>
</p>
</td>
<td>
<p><?php echo $product["Price"];?></p>
</td>
</tr>
//this is button to remove item.
<td class="td-remove">
<form method="get" action="./controllers/WishBuild.php" class="fm-remove">
<input type="hidden" name="type" value="remove">
<input type="hidden" name="id" value="<?php echo $product['id'];?>">
<button type="submit" name="removed" class="rem-btn"><i class="fas fa-minus"></i>REMOVE</button>
</form>
</td>
<?php
}
endforeach;
}
?>
I have several categories, titled Part1, Part2, Part3...etc. So the above code is for one category. Basically, part1 takes you to part1 products and so on, if product in part1 is added then display it in part1 then user goes onto adding part2...etc. So far the above code works I can add the products and they show where they need to be but the "add" links still show and want them to be hidden. Trying to figure out best way to do this and how. Thanks for any input.