Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

223
Views
Php $_SESSIONS How do I make buttons disappear and change to product info

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;
 } 
 ?>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!