procesar

3
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'";

Upload: lismirabal

Post on 15-Jun-2015

49 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Procesar

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)

Page 2: Procesar

{//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>