Ver Mensaje Individual
  #9 (permalink)  
Antiguo 16/12/2008, 06:05
Avatar de Panino5001
Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 19 años, 10 meses
Puntos: 834
Respuesta: Boton para combobox

En ese caso, probá esto:
Código PHP:
<!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=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>
<script>
onload=function(){
    if(window.name.indexOf('itemSeleccionado_')!=-1){
        var sel=window.name.split('itemSeleccionado_').pop();
        for(var i=0,l;l=document.getElementById('pp').options[i];i++){
            if(i==parseInt(sel))
                l.selected=1;
            else
                l.selected=0;    
        }
    }
}
</script>
<body>
<?php
if (isset($_POST['select']))
{
    
$datosexplode(',',$_POST['select']);
    for(
$i=0;$i<sizeof($datos);$i++)
    {
        
$tmpexplode('=',$datos[$i]);
        
$var[$tmp[0]]= $tmp[1];
    }
  
extract($var);
 
  
$txt"<font size='6' font color=\"red\">"."Precio: $valor\n"."</font>";
  
$txt.= "<font color=\"green\">"."Valor: $media\n"."</font>";

  echo 
nl2br($txt);
//fin de si POST[select]
?>
          </p>      </td>
        </tr>
      <tr bgcolor="#FFFFFF">
        <td width="170" height="80" align="left" valign="bottom">
<form name="form1" method="post" action="<?php if(isset($ruta) && !empty($ruta))echo $ruta; else  echo basename($_SERVER['PHP_SELF']);?>">
  <select id="pp" name="select" onchange="window.name='itemSeleccionado_'+this.selectedIndex;window.location='?'+new Date().getTime()">
    <option value="valor=303,media=6.20,ruta=http://www.google.com">CHARGE 6.20</option>
    <option value="valor=2,media=6.20,ruta=http://www.yahoo.com.com">dos</option>
    <option value="valor=3,media=6.20,ruta=http://www.forosdelweb.com">tres</option>
    <option value="valor=4,media=6.20,ruta=http://www.php-hispano.net.com">cuatro</option>
  </select>            
  
  <?php if(isset($ruta) && !empty($ruta)){ ?><input name="Submit2" type="submit" id="Submit2" value="Ir a <?php echo $ruta ?>" />
  <?php }else{ ?><input name="submit" type="submit" value="VER" /><?php ?>
</form>
</body>
</html>
Es importante la relación entre el id del select y la función que se ejecuta al cargar la página.