Created
January 6, 2015 00:29
-
-
Save ricardosiri68/d845c8b53c8d50f26a79 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<script type = "text/javascript" src = "jquery-2.1.3.js"></script> | |
<title>Documento sin título</title> | |
</head> | |
<body> | |
<form id="form1" name="form1" method="post" action=""> | |
<p>Codigo | |
<input type="text" name="txtCodigo" id="txtCodigo" /> | |
<br /> | |
</p> | |
<p>Nombres | |
<input type="text" name="txtNombres" id="txtNombres" /> | |
<br /> | |
</p> | |
<p>Apellidos | |
<label for="txtApellidos"></label> | |
<input type="text" name="txtApellidos" id="txtApellidos" /> | |
</p> | |
<p>Correo | |
<label for="txtCorreo"></label> | |
<input type="text" name="txtCorreo" id="txtCorreo" /> | |
</p> | |
<p> </p> | |
<p> | |
<input type="submit" name="txtGuardar" id="txtGuardar" value="Guardar" onClick="validar()"/> | |
</p> | |
</form> | |
<div id= "result" > </div> | |
<script type = "text/javascript"> | |
function validar() | |
{ | |
codigo = document.getElementById('txtCodigo').value; | |
nombre = document.getElementById('txtNombres').value; | |
apellido = document.getElementById('txtApellidos').value; | |
Correo = document.getElementById('txtCorreo').value; | |
if(nombre.length == 0 && apellido.length == 0 && Correo.length == 0) | |
{ | |
alert("Verifique que todo este lleno"); | |
} | |
else | |
{ | |
var sql = "INSERT INTO empleados(`Nombres`,`Apellidos`,`Correo`) VALUES ('"+nombre+"','"+apellido+"','"+Correo+"')"; | |
$.post('conexion.php',{postname:sqñ}, | |
function(data) | |
{ | |
$('#result').html(data); | |
}); | |
} | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment