Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/10/2004, 13:22
Avatar de JuanKa
JuanKa
 
Fecha de Ingreso: septiembre-2004
Mensajes: 468
Antigüedad: 19 años, 7 meses
Puntos: 1
Seleccion de Sub Familias.

Hola todos.
Tengo un script que lo he estado haciendo de varias maneras pero no tengo el resultado que deseo.

Tengo 2 tablas (Familias y Sub_Familias), cuando llamo a esta pagina hago una consulta de todas las familias existentes, es decir un barrido total, y luego lo muestro en el navegador, cuando selecciono cualquier Familia me llama todas las sub familias que pertenecen a esta familia hasta aca no hay problema.
El problema radica cuando selecciono una sub_familia me muestra los articulos, pero las subfamilias desaparecen (vuelve a la pagina como fue al inicio) de tal manera que cuando quiero que seleccionar nuevamenete la subfamilia. tengo que seleccionar la familia y despues la sub familias, lo que yo quiero es que se quede las sub familias para luego escoger.
***** FAMILIAS
1 Conectores
2 Impresoras
3 Monitores
*******

**** CUANDO SELECCIONO UNA FAMILIA***
1 Conectores
2 Impresoras
->Epson
->HP
->Canon
->Panasonic

3Monitores

se debe quedar asi para que luego yo pueda escoger cualquier sub familia, pero despues que selecciono EPSON (me muestra los articulos), vuelve a:

1 Conectores
2 Impresoras
3 Monitores

Y yo deseo que se quede asi
1 Conectores
2 Impresoras
->Epson
->HP
->Canon
->Panasonic

3 Monitores

Aca les envio el SCRIPT


<?php
include("Php/config.php");
$cod=$_GET['codi_fami'];
$sub=$_GET['codi_sub'];

$consulta =mysql_query("SELECT * FROM familias order by nom_fam ",$conectar);

$consu=mysql_query("SELECT cod_sub_fam,nom_sub_fam FROM sub_familias WHERE cod_fam='$cod'",$conectar);

$consul = mysql_query("SELECT * FROM articulos WHERE cod_sub_fam='$sub'",$conectar);
?>

codigo html....

<?php
while ($fam=mysql_fetch_array($consulta))
{echo "<tr>";
echo "<td height='22' bgcolor='#FFDF7D' width='230' >";
echo '<div align="left">';
echo "<img src='Imagenes/boton_mas.jpg'>";
echo " <a href=\"cat_ventas.php?codi_fami=$fam[cod_fam]\">$fam[nom_fam]</a>";
echo "</div>";

if ($cod==$fam['cod_fam'])
{echo "<table border='0' align='left' cellpadding='0' cellspacing='0' >";
while ($subfam=mysql_fetch_array($consu))
{echo "<tr>";
echo "<td height='18' bgcolor='#CCCCCC' width='230' >";
echo '<div align="left">';
echo "<img src='Imagenes/boton_ir.gif'>";
echo "<a href=\"cat_ventas.php?codi_sub=$subfam[cod_sub_fam]\">$subfam[nom_sub_fam]</a>";
echo "</div>";
echo "</td>";
echo "</tr> ";
}
echo "</table>";

}
echo "</td>";
echo "</tr> ";
}
?>
</table></th>
<th width="365" valign="top" bgcolor="#FFFFFF" scope="col">
<?php
//** ESTA ES LA RUTINA PARA QUE CUANDO PRESIONE LA SUB FAMILIA ME MUESTRE SUS ARTICULOS ***** echo "<table width='365' border='0' align='center' cellpadding='0' cellspacing='0'>";
while ($art=mysql_fetch_array($consul))
{
echo "<tr>";
echo "<th height='23' colspan='2' ><div align='center'>";
echo "<table width='365' height='19' border='0' cellpadding='0' cellspacing='0' bgcolor='#DFDFDF'>";
echo "<tr>";
echo "<th width='14' height='19' scope='col'><img src='Imagenes/botoneraflecha2.gif' width='12' height='13'></th>";
echo "<th width='351' bgcolor='#DFDFDF' class='Estilo106' scope='col'><div align='left'>".$art['nom_art']."</div></th>";
echo "</tr>";
echo "</table>";
echo "</div></th>";
echo "</tr>";
echo "<tr>";
echo "<th width='100' height='83'><a href=\"cat_ventas_puntual.php?cod=".$art['cod_art']."\"><img src=\"thumbnail.php?ruta=Archivos/".$art['ima1']."\" border='0' alt='Mas Información'></th>";
echo "<th width='265'><table width='260' border='0' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<th width='65' scope='col'><div align='center' class='Estilo104'>";
echo "<div align='left'>Codigo</div>";
echo "</div></th>";
echo "<th width='12' scope='col'><div align='center'>:</div></th>";
echo "<th width='183' class='Estilo104' scope='col'><div align='left'>".$art['cod_art']."</div></th>";
echo "</tr>";
echo "<tr>";
echo "<td><div align='center' class='Estilo104'>";
echo "<div align='left'>Precio</div>";
echo "</div></td>";
echo "<td><div align='center'>:</div></td>";
echo "<td><div align='left'><span class='Estilo106'>".$art['pre_art']."</span> <span class='Estilo104'>&euro; </span></div></td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='3'><div align='left' class='Estilo104'><form name='form1' method='post' action='cesta.php?action=add_item&id=$art[cod_art]'>
Comprar&nbsp;&nbsp; : <input name='txt_cantidad' type='text' id='txt_cantidad' value='1' size='3' maxlength='3'>
&nbsp;&nbsp;&nbsp;<input type='submit' name='A Cesta' value='Enviar'> </form> </div></td>";
echo "</tr>";
echo "</table>";
echo "</th>";
echo "</tr>";
}
echo "</table>";
//********************************************* FIN ?>


GRACIAS.