<?php

echo "<link rel='stylesheet' href='css/style.css' type='text/css' media='all'>";
include "../persistence_layer/conect.php";
include "../bussines_layer/gestion_empresa_bussines.php";
if (isset($_GET["borra"]) and isset($_GET["eliminar"])) {
    alta_baja_empresa($_GET["eliminar"], $_GET["borra"]);
    echo "<div align=center><h1>SU EMPRESA SE HA DADO DE BAJA CON EXITO!!\n\t\t<meta http-equiv='Refresh' content='2;url=gestion_empresa.php'></font></h1></div>";
} else {
    $empresa = recuperar_empresa($_GET["id"]);
    echo "<div align=center><h1>ELIMINAR EMPRESA</h1><br><h2>" . $empresa->get_nombre() . "<br>direccion: " . $empresa->get_direccion() . "<br><br><br>";
    echo "<notif>ESTA SEGURO?</notif><br><br>";
    echo "<h3>SE DARA DE BAJA LA EMPRESA Y TODOS LOS PRODUCTOS QUE OFRECE LA MISMA</h3>";
    echo "<table class=tablas><tr>";
    echo "<td width=50%><a href=gestion_empresa_eliminar.php?eliminar=" . $_GET["id"] . "&borra=0><notifsi>SI</notifsi></a></td>";
    echo "<td width=50%><a href=gestion_empresa.php><notifno>NO</notifno></a></td>";
    echo "</tr></table>";
}
<?php

echo "<link rel='stylesheet' href='css/style.css' type='text/css' media='all'>";
include "../persistence_layer/conect.php";
include "../bussines_layer/gestion_producto_bussines.php";
if (isset($_POST["nombre"])) {
    $rowEmp = recuperar_empresa($_POST["empresa"]);
    actualizar_producto($_POST["nombre"], $_POST["descripcion"], $_POST["precio"], $rowEmp->get_empresa(), $_POST["stock"], $_POST["url"], $_POST["id"], 1);
    echo "<div align=center><h1>SU PRODUCTO SE HA MODIFICADO CON EXITO!!\n\t\t<meta http-equiv='Refresh' content='2;url=gestion_empresa.php'></font></h1></div>";
} else {
    $empresas = catalogo_empresas2();
    $producto = recuperar_producto($_GET["id"]);
    echo "<div align=center><h1>MODIFICAR PRODUCTO</h1><br>";
    echo "<form name=form action=" . $_SERVER['PHP_SELF'] . " method='post'>";
    echo "<table class=tablas>";
    echo "<tr><td><input type='text' hidden required name=id value='" . $producto->get_id_producto() . "'></td></tr>";
    echo "<tr><th><h4>Nombre</th><td><input type='text' required name=nombre value='" . $producto->get_nombre() . "'></td></tr>";
    echo "<tr><th><h4>Empresa</th><td><select required name=empresa>";
    for ($i = 0; $i < count($empresas); $i++) {
        echo "<option>" . $empresas[$i]->get_empresa() . "</option>";
    }
    echo "</select> </td></tr>";
    echo "<tr><th><h4>Precio</th><td><input type='text' required name=precio value='" . $producto->get_precio() . "'></td></tr>";
    echo "<tr><th><h4>Descripcion</th><td><input type='text' required name=descripcion value='" . $producto->get_descripcion() . "'></td></tr>";
    echo "<tr><th><h4>Stock</th><td><input type='number' required min='1' max='999' name=stock value='" . $producto->get_stock() . "'></td></tr>";
    echo "<tr><th><h4>Imagen</th><td><input type='text' required name=url placeholder='URL de la imagen' value='" . $producto->get_url() . "'></td></tr>";
    echo "</table><br>";
    echo "<input type='submit' value='Modificar'>";
    echo "</form>";
}