Ver Mensaje Individual
  #5 (permalink)  
Antiguo 12/09/2008, 15:16
txino_2
 
Fecha de Ingreso: agosto-2006
Mensajes: 173
Antigüedad: 17 años, 8 meses
Puntos: 1
Respuesta: Consulta BD mediante select en formulario

Me contesto a mi mismo

Pagina buscador.php, con select que llevan consulta a la db para mostrar los nombres grabados

Código PHP:
<form name="form1" action="encontrado.php" method="post">
          <table width="80%" border="0">
            <tr>
              <td><span class="Estilo29">Buscar por canal </span></td>
              <td><select name="canal">
                <option value=''>Canal
                  <?php do { ?>
                  <option value='<?php echo $row_canales['canal']; ?>'><?php echo $row_canales['canal']; ?>
                    <?php } while ($row_canales mysql_fetch_assoc($canales)); ?>
                            </select></td>
            </tr>
            <tr>
              <td colspan="2" align="center"><input type="submit" value="Buscar Canal"></td>
              </tr>
          </table>

</form>
Pagina encontrado.php

Código PHP:
<?php

if (isset($_POST["sate"])) $sate=$_POST["sate"];
if (isset(
$_POST["canal"]))  $canal=$_POST["canal"];
if (isset(
$_POST["fta"]))  $fta=$_POST["fta"];

?> 

<?php
$colname_Recordset1 
"-1";
if (isset(
$_POST['sat'])) {
  
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_POST['sat'] : addslashes($_POST['sat']);
}
mysql_select_db($database_conexion1$conexion1);
$query_Recordset1 sprintf("SELECT * FROM canales WHERE canal = '$canal' ORDER BY canal ASC"$colname_Recordset1);
$Recordset1 mysql_query($query_Recordset1$conexion1) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($Recordset1);
?>

<table border="0" cellpadding="0" cellspacing="0" width="780">
  <tbody>
    <tr align="center" bgcolor="#FFFFFF" valign="top">
      <td colspan="2" bgcolor="#FFFFFF"><?php @include("modulos/header.php"); ?></td>
      </tr>
    <tr align="center" valign="top">
    <td class="menudos" width="166"><?php @include("modulos/menu.php"); ?>
      <div align="left"></div>
      <table border="0" width="165">
                <tr>
          <td></td>
        </tr>
      </table>
      <?php @include("modulos/traductor.php"); ?>
      <?php @include("modulos/enlaces.php"); ?>
      <?php @include("modulos/historico.php"); ?>
      <?php @include("modulos/afiliados.php"); ?>
      <?php @include("http://www.apuestatv.es/modulos/publicidad1.php"); ?>
<table border="0" cellpadding="0" cellspacing="0" width="165">
    <tbody><tr>
        <td align="center"></td>
    </tr>
</tbody></table>
      <br>    </td>
      <td width="879"> 
           <table width="564" border="0" cellpadding="0" cellspacing="0" align="center">
    <tbody>
      <tr bgcolor="#101070">
        <td colspan="3"><img src="a_data/pix.gif" height="1" width="1"></td>
      </tr>
      <tr bgcolor="#ffffff">
        <td width="4" background="a_data/wl.gif">&nbsp;</td>
        <td width="864" rowspan="2"><div align="center" class="Estilo26">Frecuencias encontradas en su busqueda</div>
          <center>
            <?php if ($totalRows_Recordset1 0) { // Show if recordset not empty ?>
              <table border="1" cellpadding="0" cellspacing="0" width="600" align="center">
                <tr>
                  <td width="125" bgcolor="#336699"><span class="Estilo21">Nombre Canal </span></td>
          <td width="40" bgcolor="#336699"><div align="center"><span class="Estilo21">Po</span></div></td>
          <td width="107" bgcolor="#336699"><span class="Estilo21">Satelite</span></td>
          <td width="50" bgcolor="#336699"><div align="center"><span class="Estilo21">Frecu</span></div></td>
          <td width="50" bgcolor="#336699"><div align="center"><span class="Estilo21">S/ R </span></div></td>
          <td width="50" bgcolor="#336699"><div align="center"><span class="Estilo21">Pol</span></div></td>
          <td width="103" bgcolor="#336699"><span class="Estilo21">Encriptaci&oacute;n</span></td>
      </tr>
                <?php do { ?>
                  <tr>
                    <td bgcolor="#e3eaf2"><span class="Estilo26"><?php echo $row_Recordset1['canal']; ?></span></td>
                    <td bgcolor="#e3eaf2"><div align="center" class="Estilo27"><?php echo $row_Recordset1['pos']; ?></div></td>
                    <td bgcolor="#e3eaf2" class="Estilo27"><?php echo $row_Recordset1['sat']; ?></td>
                    <td bgcolor="#e3eaf2"><div align="center" class="Estilo27"><?php echo $row_Recordset1['fr']; ?></div></td>
                    <td bgcolor="#e3eaf2"><div align="center" class="Estilo27"><?php echo $row_Recordset1['sb']; ?></div></td>
                    <td bgcolor="#e3eaf2"><div align="center" class="Estilo27"><?php echo $row_Recordset1['po']; ?></div></td>
                    <td bgcolor="#e3eaf2" class="Estilo28"><?php echo $row_Recordset1['en']; ?></td>
                  </tr>
                  <?php } while ($row_Recordset1 mysql_fetch_assoc($Recordset1)); ?>
                  </table>