Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/05/2010, 11:16
airknightz
Invitado
 
Mensajes: n/a
Puntos:
Pregunta Ayuda! ComboBox Multiple

Saludos colegas! Mi caso es el sgte: Tengo 3 combobox, en donde al seleccionar una opcion del 1er CB esta debe almacenarse, guardarse y ser enviada como una entrada para el 2do CB, para que este muestre sus respectivas opciones, y asi para el 3er CB. He usado el evento onchange.

MENU.PHP
<h2 align="center">MENU PRINCIPAL</h2>
<table width="400" border="0" align="center">
<tr>
<td>SECCION
<select onchange="submit()" name="cmb_sec" id="cmb_sec">
<option SELECTED >--seleccion--- </option>
<?php
include("clases.class");
$sec=new Principal();
$sec->Seccion();
?>
</select>
</td>

<td>CATEGORIA<select onchange="submit()" name="cmb_cat" id="cmb_cat">
<option >--selecciona--</option>
<?php
$par1=$_GET['cmb_sec'];
if(!$par1==0){
$lucy=new Principal();
$lucy->Categoria($par1);
}
?>

</select></td>
<td>LINEA<select onchange="submit()" name="cmb_lin" id="cmb_lin">
<option SELECTED >--seleccion--- </option>
<?php
$par2=$_GET['cmb_cat'];
if(!$par2==0){
$luc=new Principal();
$luc->Linea($par2);
}
?>

</select></td>
</tr>
</table>

<table width="400" border="0" align="center">
<tr>
<td>
Ordenar por: <select onchange="submit()" name="cmb_ord" id="cmb_ord">
</td>
</tr><tr>
<td width='100' height='100'>

<?php

$par3=$_GET['cmb_lin'];
if(!$par3==0){
$lu=new Principal();
$lu->ImagenLinea($par3);
}
?>

</td>
<td rowspan="8" width='300' height='100'>
Listado de produtos ....
<?php
if(!$par1==0 and !$par2==0 and !$par3==0){
$lista=new Principal();
$lista->ListProduc($par1,$par2,$par3);
//$lista->ListProduc('S0001','C0001','L0001');
}
?>



CLASES.CLASS

<?php
class Principal{

function Conexion(){
$this->cn=mysql_connect("localhost","root","123456") or die("No se pudo conectar al SERVER");
mysql_select_db("bdtienda") or die ("No se pudo seleccionar BD");
}

var $var1;
var $var2;

function Seccion(){
$this->Conexion();
$sql="select cod_sec, nom_sec from seccion";
$rs=mysql_query($sql,$this->cn);

while ($row = mysql_fetch_array($rs)) {
echo "<option value='".$row[0]."'>".$row[1]."</option>";
}
mysql_free_result($rs);
}

function Categoria($var1){
$this->Conexion();
$sql="select cod_cate,nom_cate from categoria where cod_sec='$var1'";
$rs=mysql_query($sql,$this->cn);

while ($row = mysql_fetch_array($rs)) {
echo "<option value='".$row[0]."'>".$row[1]."</option>";

}
mysql_free_result($rs);
}

function Linea($var1){
$this->Conexion();
$sql="select * from linea where cod_cate='$var1'";
$rs=mysql_query($sql,$this->cn);

while ($row = mysql_fetch_array($rs)) {
echo "<option value='".$row[0]."'>".$row[3]."</option>";

}
mysql_free_result($rs);
}


function ImagenLinea($var1){
$this->Conexion();
$sql="select nom_linea from linea where cod_linea='$var1'";
$rs=mysql_query($sql,$this->cn);

while ($row = mysql_fetch_array($rs)) {
echo "<img src='images/linea/".$row[0].".jpg' width='100' height='100'>";
}
mysql_free_result($rs);
}

function Redireccionar(){
header("Location: index.html");
}
?>

EN FIN: el punto es que cada vez que se activa el evento "onchange" se refresca la pagina y sobrescribe variables. Eso no me permite tenerlas almacenadas. Alguna idea para solucinar este problema. Thnks!