0

Hi, i'm working on a website where i have the list of all products with image, category, name of the product and its reference. What I'm trying to do is creating a checkbox and when it is checked it erases all that info (category, name of the product and reference) and only leaves the image.

I was thinking of a select so it know which image is, right?

<?php require_once('Connections/futura.php'); ?>
<?php
set_time_limit(0);
include("incluir.php");


$query_categorias = "SELECT * FROM materiais ORDER BY ordem ASC";
$categorias = mysql_query($query_categorias, $futura) or die(mysql_error());
$row_categorias = mysql_fetch_assoc($categorias);
$totalRows_categorias = mysql_num_rows($categorias);

$query_cores = "SELECT * FROM janelas WHERE id_categoria='2'";
$cores = mysql_query($query_cores, $futura) or die(mysql_error());
$row_cores = mysql_fetch_assoc($cores);
$totalRows_cores = mysql_num_rows($cores);


$query_categ_list = "SELECT * FROM materiais ORDER BY ordem ASC";
$categ_list = mysql_query($query_categ_list, $futura) or die(mysql_error());
$row_categ_list = mysql_fetch_assoc($categ_list);
$totalRows_categ_list = mysql_num_rows($categ_list);





?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" type="image/x-icon" href="imagens/plasticos.ico" />
<link href="styles/style.css" rel="stylesheet" />
<title>Plásticos Futura - Produtos</title>
<script type="text/javascript" src="js/java.js"></script>
</head>

<body>
<table width="1200" border="0" align="center" cellpadding="0" cellspacing="0" style="background-image:url(imagens/fundo7.jpg);background-repeat:repeat-y;">
<tr>
<td>
<table width="1200" border="0" align="center" cellpadding="0" cellspacing="0" style="background-image:url(imagens/fundo6.jpg); background-repeat:no-repeat;" height="713" >
  <tr>
    <td height="60" valign="bottom"><?php include("topo.php"); ?></td>
  </tr>
  <tr>
    <td height="613" valign="top"><table width="1200" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td valign="top"><table width="260" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="right"><a href="index.php" title="Voltar à homepage"><img src="imagens/plasticos-futura.png" border="0" /></a></td>
          </tr>
          <tr>
            <td height="40"></td>
          </tr>
          <tr>
            <td><table width="250" border="0" align="right" cellpadding="0" cellspacing="0">
              <tr>
                <td width="30"></td>
                <td height="26" class="menu" onclick="window.location='index.php'"><a href="index.php" class="menu_text" title="Home - Plásticos Futura">Home</a></td>
              </tr>
              <tr>
                <td height="2"></td>
                <td height="2"></td>
              </tr>
              <tr>
                <td width="30"></td>
                <td height="26" class="menu" onclick="window.location='empresa.php'"><a href="empresa.php" class="menu_text" title="Empresa - Plásticos Futura">Empresa</a></td>
              </tr>
              <tr>
                <td height="2"></td>
                <td height="2"></td>
              </tr>
              <tr>
                <td width="30"></td>
                <td height="26" class="menu" onclick="window.location='produtos.php'"><a href="produtos.php" title="Produtos - Plásticos Futura" class="menu_text"><strong>Produtos</strong></a></td>
              </tr>
             <tr>
                  <td height="2"></td>
                  <td height="2"></td>
                </tr>
                 <?php do { ?>
                <tr>
                  <td width="30" height="18"></td>
                  <td height="20" class="submenu2" onclick="window.location='#cat<?php echo $row_categorias['id_material']; ?>'"><a href="#cat<?php echo $row_categorias['id_material']; ?>" class="submenu_text"><?php echo $row_categorias['material']; ?></a></td>
                </tr>
                <tr>
                  <td height="3"></td>
                  <td height="3"></td>
                </tr>
                 <?php } while ($row_categorias = mysql_fetch_assoc($categorias)); ?>

                <tr>
                  <td height="2"></td>
                  <td height="2"></td>
                </tr>
              <tr>
                <td width="30"></td>
                <td height="26" class="menu" onclick="window.location='noticias.php'"><a href="noticias.php" class="menu_text"  title="Notícias - Plásticos Futura">Notícias</a></td>
              </tr>
               <tr>
                <td height="2"></td>
                <td height="2"></td>
              </tr>
              <tr>
                  <td width="30"></td>
                  <td height="26" class="menu" onclick="window.location='oportunidades-de-negocio.php'"><a href="oportunidades-de-negocio.php" class="menu_text"  title="Oportunidades de Negócio - Plásticos Futura">Oportun. Negócio</a></td>
                </tr>
                <tr>
                  <td height="2"></td>
                  <td height="2"></td>
                </tr>
              <tr>
                  <td width="30"></td>
                  <td height="26" class="menu" onclick="window.location='recrutamento.php'"><a href="recrutamento.php" class="menu_text"  title="Recrutamento - Plásticos Futura">Recrutamento</a></td>
                </tr>
                <tr>
                  <td height="2"></td>
                  <td height="2"></td>
                </tr>
              <tr>
                <td width="30"></td>
                <td height="26" class="menu" onclick="window.location='contactos.php'"><a href="contactos.php" class="menu_text"  title="Contactos - Plásticos Futura">Contactos</a></td>
              </tr>
            </table>
            </td>
          </tr>
        </table></td>
        <td width="631" valign="top" class="texto_pretobig2" style="padding-bottom:10px;"><div class="bomfundo" style="background-color:<?php echo $row_cores['cor']; ?>;">


              <table width="570" border="0" cellspacing="0" cellpadding="0">
<?php do {  ?>

    <tr>
    <td colspan="2" class="div_topo"><a name="cat<?php echo $row_categ_list['id_material']; ?>"></a>  <strong>PRODUTOS :: <span class="texto2"><?php echo $row_categ_list['material_en']; ?></span></strong></td>
  </tr>

  <tr>
    <td colspan="2" height="16"></td>
  </tr>
  <?php 

  $query_produtos = "SELECT * FROM produtos WHERE id_material='".$row_categ_list['id_material']."' ORDER BY referencia ASC";
$produtos = mysql_query($query_produtos, $futura) or die(mysql_error());
$row_produtos = mysql_fetch_assoc($produtos);
$totalRows_produtos = mysql_num_rows($produtos);

  do {  
  $query_verimg = "SELECT * FROM produtos_img WHERE id_produto='".$row_produtos['id_produto']."' ORDER BY default_ DESC";
$verimg = mysql_query($query_verimg, $futura) or die(mysql_error());
$row_verimg = mysql_fetch_assoc($verimg);
  ?>
<!------------------------------------------------------------------------------>
    <td>     
        <input type="checkbox" name="cb[]"> Activar </input>
        <?PHP
        if(isset($_POST['cb']) && ($_POST['cb'] === "1"))
        {
            echo '<script type="text/javascript">alert("CHECK");</script>';
        }
?>
    </td>
<!------------------------------------------------------------------------------>
  <tr>
                      <td width="160" height="95" valign="top"><a href="ver_produto.php?id_produto=<?php echo $row_produtos['id_produto']; ?>&id_categoria=<?php echo $row_produtos['id_material']; ?>"><?php if($row_verimg['imagem']!="") { ?><img src="http://www.plasticos-futura.com/timthumb.php?src=http://www.plasticos-futura.com/produtos/<?php echo $row_verimg['imagem']; ?>&w=134px&h=98px&zc=1&q=100" width="134" height="98" style="border:1px solid #cccccc;" /><?php } else { ?><img src="imagens/futura.jpg" width="134" height="98" style="border:1px solid #cccccc;" /><?php } ?></a></td>
                      <td valign="top" class="texto_pretobig2"><strong>REFERÊNCIA: </strong><?php echo $row_produtos['referencia']; ?><br />
                          <strong>DESCRIÇÃO:</strong> <?php echo $row_produtos['nome']; ?>
                         <br />
<br />
<br/>
<div id="a_img">
<a href="ver_produto.php?id_produto=<?php echo $row_produtos['id_produto']; ?>&id_categoria=<?php echo $row_produtos['id_material']; ?>" class="a_img">Mais imagens</a></div></td>
                    </tr>
                    <tr>
                      <td width="160" height="10" style="border-bottom:1px dashed #e0e0e0;"> </td>
                      <td height="10" style="border-bottom:1px dashed #e0e0e0;"> </td>
                    </tr>
                    <tr>
                      <td width="160" height="10"></td>
                      <td height="10"></td>
                    </tr>
   <?php } while ($row_produtos = mysql_fetch_assoc($produtos)); ?>
                    <tr>
                      <td width="160" height="30"></td>
                      <td height="10" align="right"><a href="#topo" style="text-decoration:none;"><img src="imagens/arrow.gif" border="0" align="absmiddle" /> Topo da página</a> </td>
                    </tr>


                      <?php } while ($row_categ_list = mysql_fetch_assoc($categ_list)); ?>
                  </table>

              </div>

                </td>
        <td width="178"></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="46" style="background-image:url(imagens/fundo4.jpg); background-repeat:no-repeat"><?php include("rodape.php"); ?></td>
  </tr>
</table>
</td>
</tr>
</table>
</body>
</html>

Do you understand what i want to do?

Hope someone can help me.

Thank you,
PF2G

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by ayesha789
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.