Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

227
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda