Foros del Web » Programando para Internet » PHP »

Porblema con combobox me aparec la lista en blanco

Estas en el tema de Porblema con combobox me aparec la lista en blanco en el foro de PHP en Foros del Web. Saludos a todos, Tencon un inconveniente quiero llamar desde un combobox una lista de codigos de tareas q al precionar una d ellas automaticamente me ...
  #1 (permalink)  
Antiguo 21/08/2008, 12:54
 
Fecha de Ingreso: julio-2008
Mensajes: 129
Antigüedad: 15 años, 10 meses
Puntos: 0
Porblema con combobox me aparec la lista en blanco

Saludos a todos,
Tencon un inconveniente quiero llamar desde un combobox una lista de codigos de tareas q al precionar una d ellas automaticamente me muestre la informacion y todo lo hago llamando de la base de datos, creo q me llama la lista por q se despeja el combobox pero me sale en blanco aqui le dejo mi codigo espero cualquier tipo de ayuda
Código PHP:
<style type="text/css">
<!--
.Estilo1 {font-family: Arial}
-->
</style>
<p>
<table width="674" height="30" align="center">
  <tr bgcolor="#CCCCCC" class="Estilo1">
  <td width="87" height="24"
  </td>
</p>
<form name="form1" method="post" action="combito.php">
  <?php
$tarea
=$_GET['tarea'];
?>
  <select name="tarea" id="tarea" method="post" onChange="location.href=this.value"/>
  
  <option>__</option>
  <?php 
   
include ('connection1.php');
    
$e="SELECT tarea FROM actividades ORDER BY tarea";
    
$bus mysql_query($e,$link) or die("Error en query $e:" .mysql_error());
    while(
$g=mysql_fetch_array($bus))
    {
$h=$g['tarea'];
    
$descripcion=$g['descripcion'];
    if (
$h==$h)  
                    echo 
"<option value='combito.php.php?tarea=$tarea'selected='selected'>$descripcion</option>";
                    }
    
?>
  <input name="form1" type="hidden" value="<?php echo $tarea ?>" />
  <input name="form1" type="hidden" value="<?php echo $tarea ?>">
</form>
</form>
<form action="" name="form1" method="get">
<FORM ACTION="combito.php" class="Estilo2" id="form1" name="form1">
<form id="form1" name="form1" method="post" action="combito.php">
<label> </label>
<form method="post" action="combito.php">
&nbsp;
</td>
</tr>
<table width="513" height="73" align="center">
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td width="253"><div align="center">Sistema de Monitoreo y Evaluaci&oacute;n </div></td>
    <td width="124"><div align="center"></div>
        <div align="center">Dependencia</div></td>
    <td width="120"><div align="right"><?php echo $row {'dependencia'?></div></td>
  </tr>
</table>
<table width="514" height="30" align="center">
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td width="191">Nombre de la Tarea </td>
    <td width="311" height="24"><?php echo $row {'actividad'?></td>
  </tr>
</table>
<table width="515" height="164" align="center">
    <td width="218" bgcolor="#CCCCCC">Fecha de inicio </td>
    <td width="184" height="28" bgcolor="#CCCCCC"><p>
    <?php echo $row {'f_i'?></p></td>
    <td width="97" rowspan="6" nowrap bordercolor="#FFFFFF" bgcolor="#CCCCCC">&nbsp;</td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Fecha de final </td>
    <td height="24"><?php echo $row {'f_f'?></a></td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Fecha real de culminaci&oacute;n</td>
    <td height="24"><?php echo $row {'f_r'?></a></td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Monto de la actividad </td>
    <td height="24"><?php echo $row {'monto'?></td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Trimestre a Ejecutar </td>
    <td height="24"><?php echo $row {'trimestre'?></td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Unidad de medida: </td>
    <td height="24"><?php echo $row {'unidad'?></td>
  </tr>
</table>
<p></p>
  #2 (permalink)  
Antiguo 21/08/2008, 13:06
Avatar de ferbux  
Fecha de Ingreso: mayo-2007
Ubicación: por ahí intentado ayudar
Mensajes: 823
Antigüedad: 17 años
Puntos: 6
Respuesta: Porblema con combobox me aparec la lista en blanco

Tu variable $descripcion, puedes imprimirla para ver que tiene? antes de que la pongas en la etiqueta <option></option>.


saludos!!!
__________________
"Eres grande por que caminas entre gigantes"
  #3 (permalink)  
Antiguo 21/08/2008, 13:09
Avatar de ferbux  
Fecha de Ingreso: mayo-2007
Ubicación: por ahí intentado ayudar
Mensajes: 823
Antigüedad: 17 años
Puntos: 6
Respuesta: Porblema con combobox me aparec la lista en blanco

Tambien cambia tu parte del option por esto ya que la variable que usas ahi $descripcion puedes omitirla y poner esto:

echo "<option value='combito.php.php?tarea=$tarea' SELECTED> ".$g['descripcion']."</option>";
__________________
"Eres grande por que caminas entre gigantes"
  #4 (permalink)  
Antiguo 21/08/2008, 13:17
 
Fecha de Ingreso: julio-2008
Mensajes: 129
Antigüedad: 15 años, 10 meses
Puntos: 0
Respuesta: Porblema con combobox me aparec la lista en blanco

pero como la imprimo y gracias por la ayuda
  #5 (permalink)  
Antiguo 21/08/2008, 13:19
Avatar de ferbux  
Fecha de Ingreso: mayo-2007
Ubicación: por ahí intentado ayudar
Mensajes: 823
Antigüedad: 17 años
Puntos: 6
Respuesta: Porblema con combobox me aparec la lista en blanco

echo "<option value='combito.php.php?tarea=$tarea' SELECTED> ".$g['descripcion']."</option>";

esto no te funciono???
__________________
"Eres grande por que caminas entre gigantes"
  #6 (permalink)  
Antiguo 21/08/2008, 13:21
 
Fecha de Ingreso: julio-2008
Mensajes: 129
Antigüedad: 15 años, 10 meses
Puntos: 0
Respuesta: Porblema con combobox me aparec la lista en blanco

hic lo q me dijiste y me da igual en blanco y modifique algunas cosas asi quedo
Código PHP:
<style type="text/css">
<!--
.Estilo1 {font-family: Arial}
-->
</style>
<p>
<table width="674" height="30" align="center">
  <tr bgcolor="#CCCCCC" class="Estilo1">
  <td width="87" height="24"
  </td>
</p>
<form name="form1" method="post" action="combito.php">
  <?php
$tarea
=$_GET['tarea'];
?>
  <select name="tarea" id="tarea" method="post" onChange="location.href=this.value"/>
  
  <option>__</option>
  <?php 
   
include ('connection1.php');
    
$e="SELECT tarea FROM actividades ORDER BY tarea";
    
$bus mysql_query($e,$link) or die("Error en query $e:" .mysql_error());
    while(
$g=mysql_fetch_array($bus))
    {
$h=$g['tarea'];
    
$descripcion=$g['descripcion'];
    if (
$h==$h)  
                    echo 
"<option value='combito.php?tarea=$tarea'selected='selected'>".$g['descripcion']."</option>";
                    }
    
?>
  <input name="form1" type="hidden" value="<?php echo $tarea ?>" />
</form>
<FORM ACTION="combito.php" class="Estilo2" id="form1" name="form1" method="get">
<form id="form1" name="form1" method="post" action="combito.php">
<label> </label>
<form method="post" action="combito.php">
&nbsp;
</td>
</tr>
<table width="513" height="73" align="center">
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td width="253"><div align="center">Sistema de Monitoreo y Evaluaci&oacute;n </div></td>
    <td width="124"><div align="center"></div>
        <div align="center">Dependencia</div></td>
    <td width="120"><div align="right"><?php echo $row {'dependencia'?></div></td>
  </tr>
</table>
<table width="514" height="30" align="center">
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td width="191">Nombre de la Tarea </td>
    <td width="311" height="24"><?php echo $row {'actividad'?></td>
  </tr>
</table>
<table width="515" height="164" align="center">
    <td width="218" bgcolor="#CCCCCC">Fecha de inicio </td>
    <td width="184" height="28" bgcolor="#CCCCCC"><p>
    <?php echo $row {'f_i'?></p></td>
    <td width="97" rowspan="6" nowrap bordercolor="#FFFFFF" bgcolor="#CCCCCC">&nbsp;</td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Fecha de final </td>
    <td height="24"><?php echo $row {'f_f'?></a></td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Fecha real de culminaci&oacute;n</td>
    <td height="24"><?php echo $row {'f_r'?></a></td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Monto de la actividad </td>
    <td height="24"><?php echo $row {'monto'?></td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Trimestre a Ejecutar </td>
    <td height="24"><?php echo $row {'trimestre'?></td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Unidad de medida: </td>
    <td height="24"><?php echo $row {'unidad'?></td>
  </tr>
</table>
</form>

</form>
</form>


<p></p>
  #7 (permalink)  
Antiguo 21/08/2008, 13:25
 
Fecha de Ingreso: julio-2008
Mensajes: 129
Antigüedad: 15 años, 10 meses
Puntos: 0
Respuesta: Porblema con combobox me aparec la lista en blanco

no me funciono ni la forma que me lo explicaste ni esa
  #8 (permalink)  
Antiguo 21/08/2008, 13:25
Avatar de ferbux  
Fecha de Ingreso: mayo-2007
Ubicación: por ahí intentado ayudar
Mensajes: 823
Antigüedad: 17 años
Puntos: 6
Respuesta: Porblema con combobox me aparec la lista en blanco

Copialo asi:


Código:
<style type="text/css">
<!--
.Estilo1 {font-family: Arial}
-->
</style>
<p>
<table width="674" height="30" align="center">
  <tr bgcolor="#CCCCCC" class="Estilo1">
  <td width="87" height="24"
  </td>
</p>
<form name="form1" method="post" action="combito.php">
  <?php
$tarea=$_GET['tarea'];
?>
  <select name="tarea" id="tarea" method="post" onChange="location.href=this.value"/>
  
  <option>__</option>
  <?php 
   include ('connection1.php');
    $e="SELECT tarea FROM actividades ORDER BY tarea";
    $bus = mysql_query($e,$link) or die("Error en query $e:" .mysql_error());
    while($g=mysql_fetch_array($bus))
    {$h=$g['tarea'];
    $descripcion=$g['descripcion'];
    if ($h==$h)  
                    echo "<option value='combito.php?tarea=$tarea' selected>".$g['descripcion']."</option>";
                    }
    ?>

</select>
  <input name="form1" type="hidden" value="<?php echo $tarea ?>" />
</form>
<FORM ACTION="combito.php" class="Estilo2" id="form1" name="form1" method="get">
<form id="form1" name="form1" method="post" action="combito.php">
<label> </label>
<form method="post" action="combito.php">
&nbsp;
</td>
</tr>
<table width="513" height="73" align="center">
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td width="253"><div align="center">Sistema de Monitoreo y Evaluaci&oacute;n </div></td>
    <td width="124"><div align="center"></div>
        <div align="center">Dependencia</div></td>
    <td width="120"><div align="right"><?php echo $row {'dependencia'} ?></div></td>
  </tr>
</table>
<table width="514" height="30" align="center">
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td width="191">Nombre de la Tarea </td>
    <td width="311" height="24"><?php echo $row {'actividad'} ?></td>
  </tr>
</table>
<table width="515" height="164" align="center">
    <td width="218" bgcolor="#CCCCCC">Fecha de inicio </td>
    <td width="184" height="28" bgcolor="#CCCCCC"><p>
    <?php echo $row {'f_i'} ?></p></td>
    <td width="97" rowspan="6" nowrap bordercolor="#FFFFFF" bgcolor="#CCCCCC">&nbsp;</td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Fecha de final </td>
    <td height="24"><?php echo $row {'f_f'} ?></a></td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Fecha real de culminaci&oacute;n</td>
    <td height="24"><?php echo $row {'f_r'} ?></a></td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Monto de la actividad </td>
    <td height="24"><?php echo $row {'monto'} ?></td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Trimestre a Ejecutar </td>
    <td height="24"><?php echo $row {'trimestre'} ?></td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Unidad de medida: </td>
    <td height="24"><?php echo $row {'unidad'} ?></td>
  </tr>
</table>
</form>

</form>
</form>


<p></p>
__________________
"Eres grande por que caminas entre gigantes"
  #9 (permalink)  
Antiguo 21/08/2008, 13:27
Avatar de ferbux  
Fecha de Ingreso: mayo-2007
Ubicación: por ahí intentado ayudar
Mensajes: 823
Antigüedad: 17 años
Puntos: 6
Respuesta: Porblema con combobox me aparec la lista en blanco

Solo una duda por ke usas tantos form. te recomdaria usarás solo uno ya que todos los que usas tienen el mismo action????
__________________
"Eres grande por que caminas entre gigantes"
  #10 (permalink)  
Antiguo 21/08/2008, 13:37
 
Fecha de Ingreso: julio-2008
Mensajes: 129
Antigüedad: 15 años, 10 meses
Puntos: 0
Respuesta: Porblema con combobox me aparec la lista en blanco

si me di cuenta q tenia un form de mas, y te soy sincero soy nuevo en programando en php y colo que dos form por el metodo post para la informacion y el get por el comboboxy el otro form por el onChange="location.href=this.value" si me suguieres un cambio te lo agradeceria
  #11 (permalink)  
Antiguo 21/08/2008, 13:44
Avatar de ferbux  
Fecha de Ingreso: mayo-2007
Ubicación: por ahí intentado ayudar
Mensajes: 823
Antigüedad: 17 años
Puntos: 6
Respuesta: Porblema con combobox me aparec la lista en blanco

Pero ya te funcionó el campo select?
__________________
"Eres grande por que caminas entre gigantes"
  #12 (permalink)  
Antiguo 21/08/2008, 13:54
 
Fecha de Ingreso: julio-2008
Mensajes: 129
Antigüedad: 15 años, 10 meses
Puntos: 0
Respuesta: Porblema con combobox me aparec la lista en blanco

me quedo asi
Código PHP:
<style type="text/css">
<!--
.Estilo1 {font-family: Arial}
-->
</style>
<p>
<table width="674" height="30" align="center">
  <tr bgcolor="#CCCCCC" class="Estilo1">
  <td width="87" height="24"
  </td>
</p>
<form name="form1" method="post" action="combito.php">
  <?php
$tarea
=$_GET['tarea'];
?>
  <select name="tarea" id="tarea" method="post" onChange="location.href=this.value"/>
  
  <option>__</option>
  <?php 
   
include ('connection1.php');
    
$e="SELECT tarea FROM actividades ORDER BY tarea";
    
$bus mysql_query($e,$link) or die("Error en query $e:" .mysql_error());
    while(
$g=mysql_fetch_array($bus))
    {
$h=$g['tarea'];
    
$descripcion=$g['descripcion'];
    if (
$h==$h)  
                    echo 
"<option value='combito.php?tarea=$tarea' SELECTED> ".$g['descripcion']."</option>";
                    }
    
?>
  <input name="form1" type="hidden" value="<?php echo $tarea ?>" />
</form>
<FORM ACTION="combito.php" class="Estilo2" id="form1" name="form1" method="get">
<label> </label>
&nbsp;
</td>
</tr>
<table width="513" height="73" align="center">
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td width="253"><div align="center">Sistema de Monitoreo y Evaluaci&oacute;n </div></td>
    <td width="124"><div align="center"></div>
        <div align="center">Dependencia</div></td>
    <td width="120"><div align="right"><?php echo $row {'dependencia'?></div></td>
  </tr>
</table>
<table width="514" height="30" align="center">
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td width="191">Nombre de la Tarea </td>
    <td width="311" height="24"><?php echo $row {'actividad'?></td>
  </tr>
</table>
<table width="515" height="164" align="center">
    <td width="218" bgcolor="#CCCCCC">Fecha de inicio </td>
    <td width="184" height="28" bgcolor="#CCCCCC"><p>
    <?php echo $row {'f_i'?></p></td>
    <td width="97" rowspan="6" nowrap bordercolor="#FFFFFF" bgcolor="#CCCCCC">&nbsp;</td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Fecha de final </td>
    <td height="24"><?php echo $row {'f_f'?></a></td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Fecha real de culminaci&oacute;n</td>
    <td height="24"><?php echo $row {'f_r'?></a></td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Monto de la actividad </td>
    <td height="24"><?php echo $row {'monto'?></td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Trimestre a Ejecutar </td>
    <td height="24"><?php echo $row {'trimestre'?></td>
  </tr>
  <tr bgcolor="#CCCCCC" class="Estilo1">
    <td>Unidad de medida: </td>
    <td height="24"><?php echo $row {'unidad'?></td>
  </tr>
</table>
</form>




<p></p>
  #13 (permalink)  
Antiguo 21/08/2008, 13:59
 
Fecha de Ingreso: julio-2008
Mensajes: 129
Antigüedad: 15 años, 10 meses
Puntos: 0
Respuesta: Porblema con combobox me aparec la lista en blanco

y todavia no me funciona sigue igual ya no se que hacer de pana
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:25.