PF2G Posted May 10, 2012 at 04:43 PM Report #454437 Posted May 10, 2012 at 04:43 PM As checkbox não funcionam assim... Tens de declarar um value para a mesma, e depois esse valor virá, ou não, no POST: <input type="checkbox" name="allowupdates" value="1" /> if(isset($_POST['allowupdates']) && ($_POST['allowupdates'] === "1")) { echo '<script type="text/javascript">alert("CHECK");</script>'; } Obrigado ja ta!! 😄 Na tabela com todos os produtos existentes na BD, a tabela contem a imagem do produto a referencia e a descrição (nome). o que eu tenho de fazer se a box estiver checkada desaparece tudo ficando so a imagem. Eu tava a pensar fazer um select para que ele saiba que imagem ir busca, estou correto? Tenho aqui o codigo: <?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> -- Edit(brunoais):Identificação da linguagem das tags code e separar o código (em 2 tags code) para ficar mais fácil de ler Edit(brunoais):Tópico dividido
mjamado Posted May 10, 2012 at 04:47 PM Report #454438 Posted May 10, 2012 at 04:47 PM Dúvida nova, tópico novo. Não te esqueças de marcar este como resolvido. De qualquer das formas, a tua dúvida (nova) não é clara, tenta elaborar melhor (no novo tópico). "Para desenhar um website, não tenho que saber distinguir server-side de client-side" - um membro do fórum que se auto-intitula webdesigner. Temo pelo futuro da web.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now