Exemplo n.º 1
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
  <title>Administracion de Empresas</title>
  <link href="../css/administracion.css" rel="stylesheet" type="text/css" />
</head>
<?php 
if (isset($_POST['guardar'])) {
    $a[1] = null;
    $a[1] = $_POST['nombre'];
    $a[2] = $_POST['sigla'];
    include_once '../controller/class_pais.php';
    $empresa = new pais();
    if ($empresa->addPais($a)) {
        echo "<script>alert('Se han registrado correctamente los datos del pais')</script>";
    } else {
        echo "<script>alert('Se ha generado un problema al registrar los datos del pais')</script>";
    }
}
if (isset($_POST['modificar'])) {
    $id = $_POST['id'];
    $a[1] = $_POST['nombre'];
    $a[2] = $_POST['sigla'];
    //print_r($a);
    include_once '../controller/class_pais.php';
    $empresa = new pais();
    if ($empresa->updatePais($id, $a)) {
        echo "<script>alert('Se ha modificado correctamente los datos solicitados')</script>";
        echo "<script>window.open('paises.php','_self')</script>";
    } else {