Foros del Web » Programando para Internet » PHP »

problema con los combobox directamente de mi base de datos

Estas en el tema de problema con los combobox directamente de mi base de datos en el foro de PHP en Foros del Web. hola saludos a todos tengo un inconveniente soy nuevo en esto y espero que me ayuden en lo que puedan, al final le mostrare mi ...
  #1 (permalink)  
Antiguo 21/08/2008, 07:50
 
Fecha de Ingreso: julio-2008
Mensajes: 129
Antigüedad: 15 años, 9 meses
Puntos: 0
problema con los combobox directamente de mi base de datos

hola saludos a todos tengo un inconveniente soy nuevo en esto y espero que me ayuden en lo que puedan, al final le mostrare mi codigo que el hace un llamado de la base de datos y me muestra los campo correspondiente pero lo hace atra vez de un campo de texto es decir si el usuario coloca un codigo de actividad muestra la informacion como tal pero quisiera saber si existe la posibilidad de cargarlo automaticamente de un combobox para que el usuario no tenga problema con los codigos de actividades aqui le muestro mi codigo completo
Código PHP:
 <?php
include ('connection1.php');
$tarea $_POST['tarea'];
$query="select * from actividades where tarea ='$tarea'";
$bus mysql_query($query,$link) or die("Error en query $query:" .mysql_error());
$row mysql_fetch_array($bus);
?>
<HTML>
<TITLE>Actividades</TITLE>
<p class="Estilo4">
  </HEAD>

  <?php CabeceraPagina(); ?>
  <table width="674" height="30" align="center">
      <tr bgcolor="#CCCCCC" class="Estilo1">
        <td width="90">Cod Tarea </td>
        <td width="87" height="24">
<form name="form1" method="post" action="actiusuario.php">
<input name="tarea" type="text" id="tarea">
<input name="bus" type="submit" id="bus" value="Buscar">
</form>
<form action="" name="form1" method="get">
<FORM ACTION="procesaactividad.php" class="Estilo2" id="form1" name="form1">
<form id="form1" name="form1" method="post" action="procesaactividad.php">
    <label>
    </label>
    <form method="post" action="procesaactividad.php">&nbsp;</td>
        <td width="481" bgcolor="#FFFFFF">&nbsp;</td>
      </tr>

    <table width="23" height="26" align="center">
      <tr bgcolor="#CCCCCC" class="Estilo1">
        <td width="15" height="20" bgcolor="#FFFFFF" class="pi">&nbsp;</td>
      </tr>
    </table>
    <table width="533" border="0" align="center">
      <tr>
        <th width="555" height="572" scope="col"><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">
              <tr bgcolor="#CCCCCC" class="Estilo1">
                <td width="218">Fecha de inicio </td>
                <td width="184" height="28"><p><!-- ggPosX and ggPosY not set, so popup will autolocate to the right of the graphic -->
                    <?php echo $row {'f_i'?></p></td>
                <td width="97" rowspan="6" nowrap bordercolor="#FFFFFF">&nbsp;</td>
              </tr>
              <tr bgcolor="#CCCCCC" class="Estilo1">
                <td>Fecha de final </td>
                <td height="24"><!-- ggPosX and ggPosY not set, so popup will autolocate to the right of the graphic --><!-- ggPosX and ggPosY not set, so popup will autolocate to the right of the graphic -->
                  <a href="javascript:show_calendar('form1.f_f');" onMouseOver="window.status='Elige fecha'; overlib('Pulsa para elegir fecha del mes actual en el calendario del Sistema de Monitoreo.'); return true;" onMouseOut="window.status=''; nd(); return true;"><?php echo $row {'f_r'?></a></td>
              </tr>
              <tr bgcolor="#CCCCCC" class="Estilo1">
                <td>Fecha real de culminaci&oacute;n</td>
                <td height="24"><!-- ggPosX and ggPosY not set, so popup will autolocate to the right of the graphic -->
                  <a href="javascript:show_calendar('form1.f_r');" onMouseOver="window.status='Elige fecha'; overlib('Pulsa para elegir fecha del mes actual en el calendario del Sistema de Monitoreo.'); return true;" onMouseOut="window.status=''; nd(); return true;"><?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>&nbsp;</p>
          <?php
$num1
=$_GET["c"];
$total = ($num1/40)*100;

?>
          <table width="518" border="1" align="center">
                      <tr>
                        <td width="207"><font size="1">
                          <input size=10 name=c value="<?php echo "$num1"?>">
                        porcentaje de 40</font></td>
                        <td width="127"><font size="1">
                          =
                          <input name=total value="<?php echo "$total"?>" size=10>
                        %</font></td>
                        <td width="99"><font size="1">
                          <input name="button" type=submit value=Calculo>
                        </font></td>
                        <td width="57" bgcolor="<?php if($total<=45){ echo "red"; } else if($total<=75){ echo "yellow"; }  else if($total<=100){ echo "green"; } ?>"><?php  echo $_GET[d]."       " ?>&nbsp;</td>
                    </tr>
          </table>   

<font face="Arial, Helvetica, sans-serif" size="2">
  <!-- Begin Nedstat Basic code -->
  <!-- Title: ArgentinaNet.com.ar -->
  <!-- URL: http://www.argentinanet.com.ar/head.htm -->
</font><BR>
<BR>
        </BODY></HTML>&nbsp;          </p>
          <p>
            <input type="submit" value="Incluir" name="B1">
            </p>
          </p>
          <p>
              <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="103" height="24">
                <param name="BGCOLOR" value="">
                <param name="movie" value="button6.swf">
                <param name="quality" value="high">
                <embed src="button6.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="103" height="24" ></embed>
              </object>
        </p></th>
      </tr>
  </table>
    <p><a href="usuario2.php">
    <?php PiePagina(); ?></a></p>
  #2 (permalink)  
Antiguo 21/08/2008, 08:23
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: problema con los combobox directamente de mi base de datos

Hola Rockzilla,

Investiga sobre la sintaxis del elemento <select>, con el puedes dibujar un combobox, en las FAQs del foro hay un código para cargar un select desde una base de datos.

Saludos.
  #3 (permalink)  
Antiguo 21/08/2008, 08:54
 
Fecha de Ingreso: julio-2008
Mensajes: 129
Antigüedad: 15 años, 9 meses
Puntos: 0
Respuesta: problema con los combobox directamente de mi base de datos

gatorv hola,
ya he dado miles de vuelta con los select, query y option value pero nada me resulta lo ultimo q logre fue con el campo de texto
  #4 (permalink)  
Antiguo 21/08/2008, 09:21
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: problema con los combobox directamente de mi base de datos

Hola Rockzilla,

Si especificas cual es tu error, es más facil que te ayudemos.

Saludos.
  #5 (permalink)  
Antiguo 21/08/2008, 10:01
 
Fecha de Ingreso: julio-2008
Mensajes: 129
Antigüedad: 15 años, 9 meses
Puntos: 0
Respuesta: problema con los combobox directamente de mi base de datos

nuevamente hola este es el select que inserte pero nada me sale en blanco
Código PHP:
  <select name="tarea" id="tarea" /> 
   <?php 
   
include ('connection1.php');
    
$e="SELECT tarea FROM actividades ORDER BY tarea";
    
$bus mysql_query($query,$link) or die("Error en query $query:" .mysql_error());
    while(
$g=mysql_fetch_array($bus))
    {
$h=$g['tarea'];
    
?>
    <option value="form1" > </option >                    
    <?php ?>
  #6 (permalink)  
Antiguo 21/08/2008, 10:14
 
Fecha de Ingreso: julio-2008
Mensajes: 129
Antigüedad: 15 años, 9 meses
Puntos: 0
Respuesta: problema con los combobox directamente de mi base de datos

Y no me sale nada en blanco no se cual sea el problema y no me llama a nada aqui esta nuevamente el codigo completo
Código PHP:
 <?php include("principal.php"?>
 <?php
include ('connection1.php');
$tarea $_POST['tarea'];
$query="select * from actividades where tarea ='$tarea'";
$bus mysql_query($query,$link) or die("Error en query $query:" .mysql_error());
$row mysql_fetch_array($bus);
?>
<HTML>
<TITLE>Actividades</TITLE>
<p class="Estilo4">
  </HEAD>

  <?php CabeceraPagina(); ?>
  <table width="674" height="30" align="center">
      <tr bgcolor="#CCCCCC" class="Estilo1">
        <td width="90">Cod Tarea </td>
        <td width="87" height="24">
<form name="form1" method="post" action="actiusuario.php">

  <select name="tarea" id="tarea" /> 
   <?php 
   
include ('connection1.php');
    
$e="SELECT tarea FROM actividades ORDER BY tarea";
    
$bus mysql_query($query,$link) or die("Error en query $query:" .mysql_error());
    while(
$g=mysql_fetch_array($bus))
    {
$h=$g['tarea'];
    
?>
    <option value="form1" > </option >                    
    <?php ?>

    

    
    
</form>
<form action="" name="form1" method="get">
<FORM ACTION="procesaactividad.php" class="Estilo2" id="form1" name="form1">
<form id="form1" name="form1" method="post" action="procesaactividad.php">
    <label>
    </label>
    <form method="post" action="procesaactividad.php">&nbsp;</td>
        <td width="481" bgcolor="#FFFFFF">&nbsp;</td>
      </tr>

    <table width="23" height="26" align="center">
      <tr bgcolor="#CCCCCC" class="Estilo1">
        <td width="15" height="20" bgcolor="#FFFFFF" class="pi">&nbsp;</td>
      </tr>
    </table>
    <table width="533" border="0" align="center">
      <tr>
        <th width="555" height="572" scope="col"><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">
              <tr bgcolor="#CCCCCC" class="Estilo1">
                <td width="218">Fecha de inicio </td>
                <td width="184" height="28"><p><!-- ggPosX and ggPosY not set, so popup will autolocate to the right of the graphic -->
                    <?php echo $row {'f_i'?></p></td>
                <td width="97" rowspan="6" nowrap bordercolor="#FFFFFF">&nbsp;</td>
              </tr>
              <tr bgcolor="#CCCCCC" class="Estilo1">
                <td>Fecha de final </td>
                <td height="24"><!-- ggPosX and ggPosY not set, so popup will autolocate to the right of the graphic --><!-- ggPosX and ggPosY not set, so popup will autolocate to the right of the graphic -->
                  <a href="javascript:show_calendar('form1.f_f');" onMouseOver="window.status='Elige fecha'; overlib('Pulsa para elegir fecha del mes actual en el calendario del Sistema de Monitoreo.'); return true;" onMouseOut="window.status=''; nd(); return true;"><?php echo $row {'f_r'?></a></td>
              </tr>
              <tr bgcolor="#CCCCCC" class="Estilo1">
                <td>Fecha real de culminaci&oacute;n</td>
                <td height="24"><!-- ggPosX and ggPosY not set, so popup will autolocate to the right of the graphic -->
                  <a href="javascript:show_calendar('form1.f_r');" onMouseOver="window.status='Elige fecha'; overlib('Pulsa para elegir fecha del mes actual en el calendario del Sistema de Monitoreo.'); return true;" onMouseOut="window.status=''; nd(); return true;"><?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>&nbsp;</p>
          <?php
$num1
=$_GET["c"];
$total = ($num1/40)*100;

?>
          <table width="518" border="1" align="center">
                      <tr>
                        <td width="207"><font size="1">
                          <input size=10 name=c value="<?php echo "$num1"?>">
                        porcentaje de 40</font></td>
                        <td width="127"><font size="1">
                          =
                          <input name=total value="<?php echo "$total"?>" size=10>
                        %</font></td>
                        <td width="99"><font size="1">
                          <input name="button" type=submit value=Calculo>
                        </font></td>
                        <td width="57" bgcolor="<?php if($total<=45){ echo "red"; } else if($total<=75){ echo "yellow"; }  else if($total<=100){ echo "green"; } ?>"><?php  echo $_GET[d]."       " ?>&nbsp;</td>
                    </tr>
          </table>   

<font face="Arial, Helvetica, sans-serif" size="2">
  <!-- Begin Nedstat Basic code -->
  <!-- Title: ArgentinaNet.com.ar -->
  <!-- URL: http://www.argentinanet.com.ar/head.htm -->
</font><BR>
<BR>
        </BODY></HTML>&nbsp;          </p>
          <p>
            <input type="submit" value="Incluir" name="B1">
            </p>
          </p>
          <p>
              <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="103" height="24">
                <param name="BGCOLOR" value="">
                <param name="movie" value="button6.swf">
                <param name="quality" value="high">
                <embed src="button6.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="103" height="24" ></embed>
              </object>
        </p></th>
      </tr>
  </table>
    <p><a href="usuario2.php">
    <?php PiePagina(); ?></a></p>
    </form>
</form>
</form>
</form>

<p>
SI DESEAS LE QUITO EL COLOR PARA COLOR PARA QUE NO SE VEAN EXTENSO
  #7 (permalink)  
Antiguo 21/08/2008, 10:16
 
Fecha de Ingreso: julio-2008
Mensajes: 129
Antigüedad: 15 años, 9 meses
Puntos: 0
Respuesta: problema con los combobox directamente de mi base de datos

Y no me sale nada en blanco no se cual sea el problema y no me llama a nada aqui esta nuevamente el codigo completo
Código PHP:
 <?php include("principal.php"?>
 <?php
include ('connection1.php');
$tarea $_POST['tarea'];
$query="select * from actividades where tarea ='$tarea'";
$bus mysql_query($query,$link) or die("Error en query $query:" .mysql_error());
$row mysql_fetch_array($bus);
?>
<HTML>
<TITLE>Actividades</TITLE>
<p class="Estilo4">
  </HEAD>

  <?php CabeceraPagina(); ?>
  <table width="674" height="30" align="center">
      <tr bgcolor="#CCCCCC" class="Estilo1">
        <td width="90">Cod Tarea </td>
        <td width="87" height="24">
<form name="form1" method="post" action="actiusuario.php">

  <select name="tarea" id="tarea" /> 
   <?php 
   
include ('connection1.php');
    
$e="SELECT tarea FROM actividades ORDER BY tarea";
    
$bus mysql_query($query,$link) or die("Error en query $query:" .mysql_error());
    while(
$g=mysql_fetch_array($bus))
    {
$h=$g['tarea'];
    
?>
    <option value="form1" > </option >                    
    <?php ?>

    

    
    
</form>
<form action="" name="form1" method="get">
<FORM ACTION="procesaactividad.php" class="Estilo2" id="form1" name="form1">
<form id="form1" name="form1" method="post" action="procesaactividad.php">
    <label>
    </label>
    <form method="post" action="procesaactividad.php">&nbsp;</td>
        <td width="481" bgcolor="#FFFFFF">&nbsp;</td>
      </tr>

    <table width="23" height="26" align="center">
      <tr bgcolor="#CCCCCC" class="Estilo1">
        <td width="15" height="20" bgcolor="#FFFFFF" class="pi">&nbsp;</td>
      </tr>
    </table>
    <table width="533" border="0" align="center">
      <tr>
        <th width="555" height="572" scope="col"><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">
              <tr bgcolor="#CCCCCC" class="Estilo1">
                <td width="218">Fecha de inicio </td>
                <td width="184" height="28"><p><!-- ggPosX and ggPosY not set, so popup will autolocate to the right of the graphic -->
                    <?php echo $row {'f_i'?></p></td>
                <td width="97" rowspan="6" nowrap bordercolor="#FFFFFF">&nbsp;</td>
              </tr>
              <tr bgcolor="#CCCCCC" class="Estilo1">
                <td>Fecha de final </td>
                <td height="24"><!-- ggPosX and ggPosY not set, so popup will autolocate to the right of the graphic --><!-- ggPosX and ggPosY not set, so popup will autolocate to the right of the graphic -->
                  <a href="javascript:show_calendar('form1.f_f');" onMouseOver="window.status='Elige fecha'; overlib('Pulsa para elegir fecha del mes actual en el calendario del Sistema de Monitoreo.'); return true;" onMouseOut="window.status=''; nd(); return true;"><?php echo $row {'f_r'?></a></td>
              </tr>
              <tr bgcolor="#CCCCCC" class="Estilo1">
                <td>Fecha real de culminaci&oacute;n</td>
                <td height="24"><!-- ggPosX and ggPosY not set, so popup will autolocate to the right of the graphic -->
                  <a href="javascript:show_calendar('form1.f_r');" onMouseOver="window.status='Elige fecha'; overlib('Pulsa para elegir fecha del mes actual en el calendario del Sistema de Monitoreo.'); return true;" onMouseOut="window.status=''; nd(); return true;"><?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>&nbsp;</p>
          <?php
$num1
=$_GET["c"];
$total = ($num1/40)*100;

?>
          <table width="518" border="1" align="center">
                      <tr>
                        <td width="207"><font size="1">
                          <input size=10 name=c value="<?php echo "$num1"?>">
                        porcentaje de 40</font></td>
                        <td width="127"><font size="1">
                          =
                          <input name=total value="<?php echo "$total"?>" size=10>
                        %</font></td>
                        <td width="99"><font size="1">
                          <input name="button" type=submit value=Calculo>
                        </font></td>
                        <td width="57" bgcolor="<?php if($total<=45){ echo "red"; } else if($total<=75){ echo "yellow"; }  else if($total<=100){ echo "green"; } ?>"><?php  echo $_GET[d]."       " ?>&nbsp;</td>
                    </tr>
          </table>   

<font face="Arial, Helvetica, sans-serif" size="2">
  <!-- Begin Nedstat Basic code -->
  <!-- Title: ArgentinaNet.com.ar -->
  <!-- URL: http://www.argentinanet.com.ar/head.htm -->
</font><BR>
<BR>
        </BODY></HTML>&nbsp;          </p>
          <p>
            <input type="submit" value="Incluir" name="B1">
            </p>
          </p>
          <p>
              <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="103" height="24">
                <param name="BGCOLOR" value="">
                <param name="movie" value="button6.swf">
                <param name="quality" value="high">
                <embed src="button6.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="103" height="24" ></embed>
              </object>
        </p></th>
      </tr>
  </table>
    <p><a href="usuario2.php">
    <?php PiePagina(); ?></a></p>
    </form>
</form>
</form>
</form>

<p>
SI DESEAS LE QUITO EL COLOR PARA COLOR PARA QUE NO SE VEAN EXTENSO
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 00:01.