<?php

try {
    include_once '../model.business/Marcas.php';
    include_once '../model.dal/marcasDal.php';
    if (isset($_POST['txt_id'])) {
        //Class
        $m = new Marcas();
        $mD = new marcasDal();
        //SET
        $m->setIdMarca($_POST['txt_id']);
        $m->setDescripcion($_POST['txt_marca']);
        //Insert
        if ($mD->insertMarca($m) == 1) {
            header("Location: ../intranet/redirect_index_intranet_marca_creada.php");
        } else {
            header("Location: ../intranet/redirect_index_intranet_error.php");
        }
    } else {
        header("Location: ../intranet/intranet_administrador.php");
    }
} catch (Exception $e) {
    header("Location: ../intranet/redirect_index_intranet_error.php");
}
$tipoProductoDal = new TipoProductoDal();
$tipoProductoDal->listadoTipoProductos();
?>
 
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Marca
                        </td>
                        <td>
                            <select name="ddl_marca_producto"
                                    class="form-control">
                            <?php 
$marcasDal = new marcasDal();
$marcasDal->listadoMarcas();
?>
                    
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>
                           Precio 
                        </td>
                        <td>
                            <input type="number" 
                                   class="form-control"
                                   name="txt_precio" 
                                   value="" 
                <br>
                <!--End of title bar-->
                <div>
                    <form action="../process/agregar_marca.php" method="POST" >
                    <table border="1" class="w3-table w3-card indigo-l5">
                <tbody>
                    <tr>
                        <td>
                            Id Producto
                        </td>
                        <td>
                            <input class="form-control"
                                   type="text" 
                                   name="txt_id"
                                   value="<?php 
$m = new marcasDal();
echo $m->maxMarcas();
?>
" 
                                   size="5" 
                                   readonly="true" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Nombre
                        </td>
                        <td>
                            <input class="form-control"
                                   type="text" 
                                   name="txt_marca" 
 $tp = new TipoProductoDal();
 $tp->listadoTipoProductos();
 ?>
                         </select>
                     </td>
                 </tr>
                 
                 <tr class="w3-row">
                     <td class="w3-col m5">
                         Marca
                     </td>
                     <td class="w3-col m7">
                         <select name="ddl_marca_producto"
                                 class="form-control">   
                             <?php 
 $mr = new marcasDal();
 $mr->listadoMarcas();
 ?>
                         </select>
                     </td>
                 </tr>
                 
                 <tr class="w3-row">
                     <td class="w3-col m5">
                         Precio
                     </td>
                     <td class="w3-col m7">
                         <input type="number" 
                                class="form-control"
                                name="txt_precio" 
                                value="<?php