Ver Mensaje Individual
  #6 (permalink)  
Antiguo 07/04/2009, 10:31
jjhn444
 
Fecha de Ingreso: marzo-2009
Mensajes: 9
Antigüedad: 15 años, 2 meses
Puntos: 0
Respuesta: Filtrar de formulario por fecha y mostrar resultados en la misma pagina

Este es todo mi codigo:

<?php

if(!isset($variab)){
$variab=0;
}else{
$variab=$variab;
}

if(!isset($acum)){
$acum=0;
}else{
$acum=$acum;
}

$secuencia=0;

if (isset($_POST['id_pais']) or isset($_POST['id_especi']) or isset($_POST['mes'])) {

if(isset($_POST['id_pais'])){

$res_pac=mysql_db_query ($sql_db,"select * from cursos where publi=1 and id_pais='$id_pais' order by fecha_cur desc limit $variab,10");

}

if(isset($id_especi)){

$res_pac=mysql_db_query ($sql_db,"select * from cursos where publi=1 and id_especi='$id_especi' order by fecha_cur desc limit $variab,10");

}

if(isset($mes)){



$res_pac=mysql_query("select *, date_format(fecha_cur, '%m/%Y') as mes1 from cursos where publi=1 and mes1='$mes' order by fecha_cur desc limit $variab,10") or die(mysql_error());
}

}

else {

$res_pac=mysql_db_query ($sql_db,"select * from cursos where publi=1 order by fecha_cur desc limit $variab,10");

}


$secuencia=mysql_num_rows($res_pac);

$res_pact=mysql_db_query ($sql_db," select * from cursos");
$acum=$secuencia+$acum;
$tot=mysql_num_rows($res_pact);

$resto=$tot-$acum;
$antes=$tot-10;

$variab=$variab+10;



$pac5=mysql_db_query ($sql_db," select * from pais");
$pac6=mysql_db_query ($sql_db," select * from especialidad");
$pac7=mysql_query("select *, date_format(fecha_cur, '%m/%Y') as mes from cursos group by mes order by mes desc");

?>


y en el body los formularios:

<td height="42"><form id="pais" name="pais" method="post" action="evento.php">
<select name="id_pais" style="width:250px" onchange="javascript: document.pais.submit();">
<option value="" selected="selected">Seleccione un pais</option>
<?php while($registros1=mysql_fetch_array($pac5)){?>
<option value="<?php echo $registros1['id_pais'];?>"><?php echo $registros1['pais'];?></option>
<?php }?>
</select>
</form></td>
<td><form id="especialidad" name="especialidad" method="post" action="evento.php">
<select name="id_especi" style="width:250px" onchange="javascript: document.especialidad.submit();">
<option value="" selected="selected">Seleccione una especialidad</option>
<?php while($registros2=mysql_fetch_array($pac6)){?>
<option value="<?php echo $registros2["id_especi"];?>"><?php echo $registros2["especi"];?></option>
<?php }?>
</select>
</form></td>
<td><form action="evento.php" method="post" name="cursos" id="cursos">
<select name="mes" style="width:250px" onchange="javascript: document.cursos.submit();">
<option value="" selected="selected">Seleccione un Mes</option>
<?php while($registros3=mysql_fetch_array($pac7)){?>
<option value="<?php echo $registros3['mes'];?>"><?php echo $registros3['mes'];?></option>
<?php }?>
</select>
</form></td>

Mas abajo los resultados en una tabla:

<tr>
<td class="Estilo_flecha"><a href="javascript:history.go(-1)" class="Estilo12">
<?php if($variab>10){?>
&lt;&lt; Anterior
<?php }?>
</a></td>
<td><span class="Estilo13"></span></td>
<td class="Estilo_flecha"><?php if($resto>0){?>
<a href="noti.php?variab=<?php echo $variab;?>&amp;acum=<?php echo $acum; ?>" class="Estilo4">Siguiente &gt;&gt;</a>
<?php }?></td>
</tr>

<?php while($registros1=mysql_fetch_array($res_pac)){?>
<tr>
<td height="20" class=" Estilo_titu_l"><span class=" Estilo_subt_l"><a href="noti_des.php?id_noti=<?php echo $registros1["id_cur"];?>"><?php echo $registros1["evento"];?></a></span></td>
<td height="20" class=" Estilo_res_l"><a href="noti_des.php?id_noti=<?php echo $registros1["id_cur"];?>"><?php echo $registros1["fecha_cur"];?> / <?php echo $registros1["fecha_curf"];?></a></td>
<td height="20" class=" Estilo_titu_l"><span class=" Estilo_res_l"><a href="noti_des.php?id_noti=<?php echo $registros1["id_cur"];?>"><?php echo $registros1["res_noti"];?></a></span></td>
</tr>
<tr>
<td height="21" colspan="3" class=" Estilo_ver_mod"><a href="noti_des.php?id_noti=<?php echo $registros1["id_cur"];?>">ver toda la informaci&oacute;n del curso</a></td>
</tr>
<tr>
<td height="3" colspan="3" ><span class="Estilo_prolist"><img src="linea.png" width="870" height="1" /></span></td>
</tr>
<?php }?>

Este es todo mi codigo....

Gracias!