Código PHP:
<?php
session_start();
if(!isset($_SESSION[usuario]))
{
?>
<script type="text/javascript">
alert('Acceso no permitido');
top.location.href='index.php';
</script>
<?
}
include("librerias/conexion.php");
include("librerias/fecha.php");
$conexion=conectar();
if(isset($_POST[consultar]))
{
if($_POST[criterio]=="cedula")
{
$sql=mysql_query("SELECT registro.codigo,registro.cedula,registro.nombre_apellido,registro.descripcion_cargo,
registro.f_ingreso,reposos.inicio_repo,reposos.identifica_repo,reposos.tiempo,reposos.unidades FROM
registro INNER JOIN reposos ON registro.cedula = reposos.cedula_docente WHERE
registro.cedula='$_POST[valor]' AND reposos.cedula_docente='$_POST[valor]'") or die (mysql_error());
}
if($_POST[criterio]=="nombre")
{
$sql=mysql_query("SELECT registro.codigo,registro.cedula,registro.nombre_apellido,registro.descripcion_cargo,registro.f_ingreso,registro.correo,reposos.inicio_repo,reposos.identifica_repo,
reposos.tiempo,reposos.unidades,reposos.cedula_docente FROM registro INNER JOIN reposos ON registro.cedula = reposos.cedula_docente WHERE registro.nombre_apellido LIKE '%$_POST[valor]%'") or die (mysql_error());
}
if($_POST[criterio]=="fecha")
{
$sql=mysql_query("Select * from reposos where inicio_repo BETWEEN '$_POST[fecha]' and '$_POST[fecha]'");
}
}
else
{
$sql=mysql_query("SELECT registro.codigo,registro.cedula,registro.nombre_apellido,registro.descripcion_cargo,
registro.f_ingreso,reposos.inicio_repo,reposos.identifica_repo,reposos.tiempo,reposos.unidades FROM registro
INNER JOIN reposos ON registro.cedula = reposos.cedula_docente WHERE registro.cedula = reposos.cedula_docente") or die (mysql_error());
}
$filas=mysql_numrows($sql);
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
.texto:focus
{
background-color : #FBE893;
}
</style>
<style type="text/css">
table.tableizer-table {border: 1px solid #BDBDBD; font-family: Georgia, serif; font-size: 12px;} .tableizer-table td {padding: 4px; margin: 3px; border: 1px solid #BDBDBD;}
</style>
</head>
<body>
<table width="100%" valign="top" class="tableizer-table" border="0" cellspacing="4">
<form name="formulario" action="#" method="post">
<tbody style="font-size: 12px;">
<tr>
<td colspan="8" align="center" bgcolor="#DF7401" height="30"><strong>CONSULTAR REGISTROS</strong></td>
</tr>
<tr>
<td colspan="8" bgcolor="#E6E6E6">
Filtrar por: <input type="radio" name="criterio" value="cedula" onclick="document.formulario.valor.focus();" /> Cédula
<input type="radio" name="criterio" value="nombre" onclick="document.formulario.valor.focus();" /> Nombre y Apellido
<input type="text" name="valor" size="20" maxlength="20" class="texto" />
<button type="submit" name="consultar"><img src="imagenes/lupita.png" width="17" height="17" /></button>
<?
if(isset($_POST[consultar]))
{
?>
<button type="button" onclick="location.href='reportereposos.php'"><img src="imagenes/refresh.png" width="16" height="16" /></button>
<?
}
?>
<br /><br />
<input type="radio" name="criterio" value="fecha" /> Fecha:
<?echo calendario(dia,mes,anio,'0');?><input type="radio" name="criterio" value="fecha" /> Hasta:
<?echo calendario(dia,mes,anio,'0');?>
</td>
</tr>
<tr align="center" bgcolor="#DF7401">
<td><strong>Cedula</strong></td>
<td><strong>Nombre y Apellido</strong></td>
<td><strong>Descripcion del Cargo</strong></td>
<td><strong>Fecha de Ingreso</strong></td>
<td><strong>Inicio del Reposo</strong></td>
<td><strong>Duracion del Reposo</strong></td>
<td><strong>Identificacion del Reposo</strong></td>
<td><strong>Acción</strong></td>
</tr>
<?
$i=0;
while($i<$filas)
{
if($i % 2 == 0)
{
$color="bgcolor=\"#A9F5D0\"";
}
else
{
$color="bgcolor=\"#F3E2A9\"";
}
echo "
<tr $color>
<td align=\"right\" width=\"80\">".mysql_result($sql, $i, cedula)."</td>
<td>".mysql_result($sql, $i, nombre_apellido)."</td>
<td>".mysql_result($sql, $i, descripcion_cargo)."</td>
<td align=\"right\">".fecha(mysql_result($sql, $i, f_ingreso))."</td>
<td>".mysql_result($sql, $i, inicio_repo)."</td>
<td>".mysql_result($sql, $i, tiempo)." ".mysql_result($sql, $i, unidades)."</td>
<td>".mysql_result($sql, $i, identifica_repo)."</td>
<td align=\"center\"><a href=\"consulta2.php?cedula=".mysql_result($sql, $i, cedula)."\"><img src=\"imagenes/ver.png\" width=\"16\" height=\"16\" border=\"false\" /></a></td>
</tr>";
$i++;
}
mysql_close($conexion);
?>
<tr>
<td colspan="8" bgcolor="#E6E6E6" align="center">Fin de Reporte</td>
</tr>
</tbody>
</form>
</table>
</body>
</html>
<script type="text/javascript">
document.formulario.valor.focus();
</script>
Este es el Codigo Si ves algo malo aparte de mi consulta es bienvenido jeje =)