<!doctype html>



<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">


    
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Delitos</title>

    <!-- Bootstrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>


    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="estilos.css" rel="stylesheet" type="text/css">

      <!-- Add Bootstrap Links -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> 
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
</head> 

<body>

  <div class="container">
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">

<!-- Links -->
  <ul class="navbar-nav">
        <li class="nav-item">
      <a class="nav-link" href="http://www.webmy.cl/Login/inicio.php">Inicio</a>
    </li>
    
  </ul>


</nav>

      <center> <h1><em>Buscador de Delito en SAF</em></h1>  </center>

  <table class="table">
  
      <th scope="row"></th>
      <td><div class="group">
  <form action="delitos.php" method="POST">


<label>Buscar Nombre del Delito</label>
<br>   
  <div class="form-group">
    <label for="ejemplo_email_1"></label>
    <input type="text" class="form-control" name="delito" autofocus/>      
    </div>
    
     <th scope="row"></th>
      <td colspan="">

    <label>Buscar por codigo del Delito</label>
<br>   

    <div class="form-group">
    <label for="ejemplo_email_1"></label>
    <input type="text" class="form-control" name="cod" autofocus/>      
    </div>
    
    
 
     <center> <input class="btn btn-success" name="submit" type="submit" value="Buscar" /></center></td>
      <td>
      </td>

      

<table class="table">
  <thead class="table-primary">
  
    <tr>
      
      <th scope="col">DELITO</th>
      <th scope="col">CODIGO SAF</th>
      <th scope="col">ESPECIALIDAD</th>
      <th scope="col">CLASIFICACION</th>
      <th scope="col"></th>
      <th scope="col"></th>
      <th scope="col"></th>
    </tr>
  </thead>
  <tbody>
    <Br>
        <?php
        
        if($_POST['delito']=="" AND $_POST['cod']==""){
 echo "Ingresar una palabra o ";}
        
               if($_POST['delito']<>""){
 echo "<center> <h1><em>Se ha encontrado lo siguiente con ".$_POST['delito']."</em></h1>  </center>";


include("conect2.php");

  
$resultados=mysqli_query($conexion, "select DELITO, CODIGO, ESPECIALIDAD, GRUPO, ESPECIALIDAD, ID from delitos WHERE DELITO LIKE '%$_POST[delito]%'");

while($row = mysqli_fetch_assoc( $resultados )) {

    // set up a row for each record
    echo '<tr>';
    echo '<td>' . $row['DELITO']            .   '</td>';
    echo '<td>' . $row['CODIGO']    .   '</td>';
    echo '<td>' . $row['ESPECIALIDAD']     .   '</td>';
    echo '<td>' . $row['GRUPO']      .   '</td>';
    
    echo '</tr>';
}}


 echo '</tr>';
  echo '</tr>';
if($_POST['cod']==""){
 echo " codigo del delito";}
        
               if($_POST['cod']<>""){
 echo "<center> <h1><em>Se ha encontrado lo siguiente con ".$_POST['cod']."</em></h1>  </center>";


include("conect.php");

  
$resultados=mysqli_query($conexion, "select DELITO, CODIGO, ESPECIALIDAD, GRUPO, ESPECIALIDAD, ID from delitos WHERE CODIGO LIKE '%$_POST[cod]'");

while($row = mysqli_fetch_assoc( $resultados )) {

    // set up a row for each record
    echo '<tr>';
    echo '<td>' . $row['DELITO']            .   '</td>';
    echo '<td>' . $row['CODIGO']    .   '</td>';
    echo '<td>' . $row['ESPECIALIDAD']     .   '</td>';
    echo '<td>' . $row['GRUPO']      .   '</td>';
    
    echo '</tr>';
}
}else{

  
    echo "<br>";
    echo " <center> <h1><em></em></h1>  </center>";


    
}

            ?>
            
            
            
            <table class="table">
  <thead class="table-primary">
    <label>Todos los delitos</label>
    <tr>
      
      <th scope="col">DELITO</th>
      <th scope="col">CODIGO SAF</th>
      <th scope="col">ESPECIALIDAD</th>
      <th scope="col">CLASIFICACION</th>
      <th scope="col"></th>
      <th scope="col"></th>
      <th scope="col"></th>
    </tr>
  </thead>
  <tbody>
    <Br>
            
         <?php     
            
             echo '</tr>'; echo '</tr>'; echo '</tr>';
include("conect2.php");

  
$resultados=mysqli_query($conexion, "select * FROM delitos");

while($row = mysqli_fetch_assoc( $resultados )) {

    // set up a row for each record
    echo '<tr>';
    echo '<td>' . $row['DELITO']            .   '</td>';
    echo '<td>' . $row['CODIGO']    .   '</td>';
    echo '<td>' . $row['ESPECIALIDAD']     .   '</td>';
    echo '<td>' . $row['GRUPO']      .   '</td>';
    
    echo '</tr>';
}
?>
</tbody>
</table>

<footer>
  <br>
  <br>
  <br>
  <p><strong></strong> Desarrollado por Claudio Barahona </p>
  
</footer>



</body>


</div>
</diV></div>

</html>