<!DOCTYPE html>
<html lang="es">
<head>
    <title>Insert Entidad</title>
	<?php 
include 'inc/common_head.php';
?>
</head>

<?php 
include 'inc/function.php';
$function = new Reads();
$fun = $function->read_all_categories();
if (isset($_POST['nombreEntidad']) and isset($_POST['Categoria'])) {
    $function2 = new Insert();
    $ins = $function2->insert_entidad($_POST['nombreEntidad'], $_POST['Categoria']);
}
?>


<body>
    <a href="index.php">Home</a><br>
    <a href="graficos.php">Graficos</a><br>
    <a href="insert-categoria.php">Categoria</a>
    <div class="row formulario-ingreso">
        <form role="form" method="POST">
          <div class="form-group">
            <label for="nombreEntidad">Ingrese nueva Empresa</label>
            <input type="text" class="form-control" id="ejemplo_email_1" name="nombreEntidad" 
                   placeholder="Nombre o rol de empresa" required>
          </div>
<?php

include 'function.php';
$mtd = new Reads();
$name = 'US';
$empresa = $mtd->read_all_empresas();
$categoria = $mtd->read_all_categories();
$calificacion = $mtd->read_all_califications();
$empresa_name = $mtd->read_empresa_by_name($name);
$contar = $mtd->contar_calificacion($name);
echo "<pre>";
print_r($empresa);
echo "<br/>";
print_r($categoria);
echo "<br/>";
print_r($calificacion);
echo "<br/>";
print_r($empresa_name);
echo "<br/>";
print_r($contar);
echo "</pre>";