<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
$datoBuscar = NULL;
$criterio = NULL;
if (filter_input_array(INPUT_GET))
{
$datoBuscar = strtoupper(filter_input(INPUT_GET, 'Buscar', FILTER_SANITIZE_STRING));
$criterio = strtoupper(filter_input(INPUT_GET, 'por', FILTER_SANITIZE_STRING));
}
if (filter_input_array(INPUT_POST))
{
if (filter_input(INPUT_POST, 'itBusqueda') != '')
{
$datoBuscar = filter_input(INPUT_POST, 'itBusqueda');
$criterio = filter_input(INPUT_POST, 'criterio');
header("Location: WebPage_ListadoOrdenes.php?Buscar=$datoBuscar&por=$criterio");
}
}
?>
<form name="WebPage_ListadoOrdenes" action="WebPage_ListadoOrdenes.php" method="post">
<input type="radio" name="criterio" <?php if (isset($criterio) && $criterio=="DNI") echo "checked";?> value="DNI" checked="true">DNI
<input type="radio" name="criterio" <?php if (isset($criterio) && $criterio=="Email") echo "checked";?> value="Email">Email
<br><br>
<input type="text" name="itBusqueda" value="" />
<br> <br>
<input type="submit" name="btnBuscar" value="Buscar" />
<table width="55%" rules="all" border="1" align="center">
<thead>
<tr>
<th>Cliente</th>
<th>Estado</th>
<th>Observaciones</th>
<th>Resolucion Tecnico</th>
</tr>
</thead>
<tbody>
<?php
if ($datoBuscar != NULL){
$cn = new mysqli('localhost', 'root', '', 'sistegra_banco');
$query1 ="SELECT CLI.NOMECLIENTE, OS.STATUS, OS.OBSERVACOES, OS.LAUDOTECNICO
FROM clientes CLI
INNER JOIN OS ON os.Clientes_id = CLI.idClientes ";
$comilla = "'".$datoBuscar."'";
if ($criterio === 'DNI')
{
$query = $query1. " WHERE CLI.documento = $comilla";
}
else
{
$query = $query1. " WHERE CLI.email = $comilla";
}
$rs = $cn->query($query);
$vecresultado = array();
while ($fila = $rs->fetch_row())
{
array_push($vecresultado, $fila);
}
mysqli_free_result($rs);
mysqli_close($cn);
foreach($vecresultado as $lista => $valor){
?>
<tr>
<td><?php echo $valor[0]; ?></td>
<td><?php echo $valor[1]; ?></td>
<td><?php echo $valor[2]; ?></td>
<td><?php echo $valor[3]; ?></td>
</tr>
<?php } }?>
</tbody>
</table>
</form>
</body>
</html>