Ver Mensaje Individual
  #5 (permalink)  
Antiguo 07/04/2009, 09:35
subirol
 
Fecha de Ingreso: diciembre-2005
Ubicación: Vigo
Mensajes: 135
Antigüedad: 18 años, 4 meses
Puntos: 3
Respuesta: hacer consultas con un combobox

con el codigo que pones hay lo que haces es listar todos los datos pero no creas ningun combo box.
Para hacer un cobobox con los meses y los ayuntamientos tendrias que ahcer algoa si:
Código PHP:
<?php
<form name="frm" method="post" action="RptCedInf.php">
<
select name="fecha">
<?
php
$hoy
=date("Y-m-d");
$mySql="
SELECT
MONTH (tblp_capturadiaria.FecCap)
FROM
tblp_capturadiaria
"

$result=mysql_query($mySql,$link);
$row=mysql_fetch_array($result);

do{ 
?>
<option value="<? echo "$row[fecha]"?>">
<?php
}while($row=mysql_fetch_array($result));
?>
</select>
<select name="municipio">
<?php
$mySql
="
SELECT
tblc_municipios.DesMun
FROM
tblc_municipios"
;
$result_mun=mysql_query($mySql,$link);
$row_mun=mysql_fetch_array($result_mun);
do{ 
?>
<option value="<? echo "$row_mun[DesMun]"?>"><? echo "$row_mun[DesMun]"?></option>
<?php
}while($row=mysql_fetch_array($result));
?>
</select>
<input type="submit" title="enviar" value="enviar" />
</form>
Cuando selecciones el mes y el municipio envias los datos el fichero php que aparece en la etiqueta <form> "RptCedInf.php", dentro de ese documento deveria haber algo asi.

Código PHP:
<?php
$mySql
="
SELECT
tblp_capturadiaria.CveDia,
tblp_capturadiaria.OrdSac,
tblp_capturadiaria.FecCap,
tblp_capturadiaria.Estado,
tblp_capturadiaria.Especie,
tblp_capturadiaria.Sexo,
tblp_capturadiaria.UMedad,
tblp_capturadiaria.Fierro,
tblp_capturadiaria.Arete,
tblp_capturadiaria.Factura,
tblp_capturadiaria.GuiaTran,
tblp_capturadiaria.CerZoo,
tblp_capturadiaria.Decomisos,
tblp_capturadiaria.Observaciones,
tblp_capturadiaria.Edad,
tblp_introductor.NomInt,
tblp_propietario.NomProp,
tblc_municipios.DesMun,
FROM
tblp_capturadiaria ,
tblc_municipios
WHERE
tblp_capturadiaria.FecCap = $_POST[fecha] AND tblc_municipios.DesMun = $_POST[municipio]"

$result=mysql_query($mySql,$link);
$row=mysql_fetch_array($result);
do{ 
?>
aqui se mostrrian los resultados.
<?php
}while($row=mysql_fetch_array($result));
?>
Haber si te sirve, un saludo.
__________________
AlfaMeta formacion