Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/12/2014, 10:50
Fozz
 
Fecha de Ingreso: noviembre-2013
Ubicación: México
Mensajes: 94
Antigüedad: 11 años, 3 meses
Puntos: 1
Cargar automaticamente valores de un filtro por fecha

Hola que tal, estoy aquí pidiendo su valiosa ayuda, tengo un filtro por fecha; que automáticamente te carga el día en el que estés hasta el día final del mes; quiero que al momento que entré el usuario se carguen los registros de ese rango seleccionado por default es decir, por ejemplo el día de hoy se cargaría automáticamente;

Del: 26/12/2014 Al: 31/12/2014 que solo ese rango.
El filtro ya me funciona pero hasta que le doy en el botón filtrar, muchas gracias por su ayuda!!!

aquí les dejo el código.

Es la consulta:
Código PHP:
if($sql_eic!=""){
        
$sql="SELECT * FROM dbo.EVENTOS WHERE ".$sql_eic;
    echo 
$sql;
        
$res=sqlsrv_query($con,$sql);
    } 
Aquí es donde cargo el filtro por fecha, hice una función para que me trajera los días:
Código PHP:
 <?php if ($sql_eic==""){ ?>
<form METHOD="POST" ACTION="w_con_eventos_ok.php">
            <input type="checkbox" checked="checked" name="filtro_fecha" >FILTRO POR FECHAS:
            DEL: <input type="date" value="<?php echo fecha_input(); ?>" name="fecha_inicial">
            AL: <input type="date" value="<?php echo $r?>" name="fecha_final">
            
    </form>
<?php }?>
Aquí es dónde cargo los registros:

Código PHP:
else{
    ?>
        <form METHOD="POST" ACTION="w_con_eventos_ok.php">
            <div ><input type="submit" value="NUEVA BUSQUEDA"></div>
        </form>
     </div>
      <br> <br> <br> <br> <br> <br>
    <table id="estilo" border=1>
        <thead>
        <tr>
        <th></th>
        <th style="cursor: pointer;">Evento</th>
        <th style="cursor: pointer;">Instancia</th>
        <th style="cursor: pointer;">Quien Invita</th>
        <th style="cursor: pointer;">Plan</th>
        <th style="cursor: pointer;">Financiamiento</th>
        <th style="cursor: pointer;" >Representante</th>
        <th style="cursor: pointer;">Orientación Política</th>
        <th style="cursor: pointer;">Fecha y Hora</th>
        </tr>
        </thead>
        <tbody>
<?php
    $m
=0;
    while (
$f=sqlsrv_fetch_array($res))
    {
        
$m++;
        if (!
is_null($f['fecha_hora']) )
    {
?>
        <tr>
        <td><?php echo $m?></td>
        <td> <a Method="GET" href="w_imprimir_evento.php?ev=<?php echo $f['id_evento'];?>" target="_blank" onClick="window.open(this.href, this.target, 'width=800,height=600'); return false;"><?php echo utf8_encode($f['evento']); ?></a></td>
        <td><?php echo utf8_encode($f['instancia']); ?></td>
        <td><?php echo utf8_encode($f['invita']); ?></td>
        <td><?php echo utf8_encode($f['planmm']); ?></td>
        <td><?php echo utf8_encode($f['financiamiento']); ?></td>
        <td><?php echo utf8_encode($f['asistio_representante']); ?></td>
        <td><?php echo utf8_encode($f['orientacion_politica']); ?></td>
        <td><?php echo utf8_encode($f['fecha_hora']); ?></td>
        </tr>
<?php
            
    
}
     }
    } 
    
?>