procesar
TRANSCRIPT
Procesar_Estado.php
<html>
<head>
<title>ESTADO</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
body {
background-color: #FFF;
}
</style>
</head>
<body bgcolor="#000000">
<?php
include("../Controlador/conexion.php");
$conexion=Crear_Conexion('localhost','root','root');
$ssql="select * from estado where id='$id'";
$rs=Consulta_BD($ssql,'unefa',$conexion);
/* ************************/
if (mysql_num_rows($rs)!=0)
{//si el cliente esta registrado
echo'<script>alert("Este Código de Estado ya esta Registrado");</script>';
//se llama a la pagina del Incluir
echo '<script language="javascript"> location.href="../Vistas/Reg_Estado.php";</script>';
}
else{
/******************************/
$ssql="select * from estado where nombre='$nombre'";
$rs=Consulta_BD($ssql,'unefa',$conexion);
/* ************************/
if (mysql_num_rows($rs)!=0)
{//si el cliente esta registrado
echo'<script>alert("Este Nombre de Estado ya esta Registrado");</script>';
//se llama a la pagina del Incluir
echo '<script language="javascript"> location.href="../Vistas/Reg_Estado.php";</script>';
}
else{
/******************************/
$nombre=$_GET["nombre"];
mysql_query("insert into estado(nombre) values('$nombre')",$conexion);
echo '<script>alert("REGISTRO EXITOSO");</script>';
/*****VALIDACION EN CASO DE QUE LA VENTANA SE ESTE ABRIENDO***********
*****************POR EL BOTON NUEVO Y NO POR EL REGISTRAR**************/
$var=$_REQUEST["variable"];
if($var == "X")
?>
<script>
window.close()
</script>
<?php
}
}
mysql_free_result($rs);
Cerrar_Conexion($conexion);
echo '<script language="javascript"> location.href="../Vista/Reg_Estado.php?num=1";</script>';
?>
</body>
</html>