Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/11/2005, 12:10
Avatar de forecast
forecast
 
Fecha de Ingreso: octubre-2004
Mensajes: 259
Antigüedad: 20 años, 5 meses
Puntos: 4
¿Por que no funciona este onChange?

Almaceno un $html un contenido para mostrar por pantalla;

Código PHP:
$sql="SELECT * FROM empresa_producto WHERE id_empresa='".$_SESSION['empresa'];
$html.="<form name=\"formu\" action=\"".$DIR_ABS.$_SERVER['REQUEST_URI']."\" onChange=\"this.form.submit()\">";
$html.= SacaMenuDesplegable($sql,$_REQUEST['id_producto'],'subid');
$html.='</form>'
La función SacaMenuDesplegable tiene este codigo



Código PHP:
function SacaMenuDesplegable($ssql,$valor,$nombre){ 
if(
$result=mysql_query($ssql))
  {      
        
$content.="<select name='$nombre'>"
        
$content.="<option value=\"\">Todos los productos</option>\n";
        while (
$fila=mysql_fetch_row($result))
        { 
         if (
$fila[0]==$valor)
           
$content.="<option selected value='$fila[0]'>$fila[1]"
         else
           
$content.="<option value='$fila[0]'>$fila[1]"
        } 
        
$content.="</select>";
        return 
$content;
  }

Al mostrar por pantalla me aparece el select correcto, es decir todo va bien... pero al cambiar de opción no me hace el onChange="this.form.submit".

¿Alguna sugerencia?

Gracias.