Ver Mensaje Individual
  #8 (permalink)  
Antiguo 11/09/2008, 12:19
mrdy7
 
Fecha de Ingreso: agosto-2008
Mensajes: 64
Antigüedad: 16 años, 6 meses
Puntos: 0
Respuesta: Guardar Datos en phpMyadmin

Ahora si va correjido el codigo:
Código PHP:
<?php

$bd 
mysql_connect("localhost","mrdy7","mi860810") or die ("No se puede realizar la conexion a la Base de Datos");
mysql_select_db("envios");

$rep=$_GET["rep"];

if (
rep==1)
{
 
$identificacion=$_GET["identificacion"];
 
$nombre=$_GET["nombre"];
 
$apellido=$_GET["apellido"];
 
$fecha_nac=$_GET["fecha_nac"];
 
$direccion=$_GET["direccion"];
 
$telefono=$_GET["telefono"];
 
$ciudad=$_GET["ciudad"];
 
$region=$_GET["region"];
 
$pais=$_GET["pais"];
 
$cargo=$_GET["cargo"];
 
$fecha_contrato=$_GET["fecha_contrato"];

 
$sql="insert into empleados (id_empleado,nombre_emp,apellido_emp,fecha_naci,direccion_emp,telefono_emp,ciudad_emp,region_emp,pais_emp,cargo_emp,fecha_contra) values ('".$identificacion."','".$nombre."','".$apellido."','".$fecha_nac."','".$direccion."','".$telefono."','".$ciudad."','".$region."','".$pais."','".$cargo."','".$fecha_contrato."')";
 
$res=mysql_query($sql,$bd) or die(mysql_error());
}

?>

<html>
<head>
<script language="javascript">

function verifica()
{
 if (femp.identificacion.value=="")
 {
  alert ("Por favor digite la Identificacion");
  return;
 }
 if(femp.nombre.value=="")
 {
  alert ("Por favor digite el Nombre");
  return;
 }
 if(femp.apellido.value=="")
 {
  alert ("Por favor digite el Apellido");
  return;
 }
 if(femp.fecha_nac.value=="")
 {
  alert ("Por favor digite la Fecha de Nacimiento");
  return;
 }
 if(femp.direccion.value=="")
 {
  alert ("Por favor digite la Direccion");
  return;
 }
 if(femp.telefono.value=="")
 {
  alert ("Por favor digite el Telefono");
  return;
 }
 if(femp.ciudad.value=="")
 {
  alert ("Por favor digite la Ciudad");
  return;
 }
 if(femp.region.value=="")
 {
  alert ("Por favor digite la Region");
  return;
 }
 if(femp.pais.value=="")
 {
  alert ("Por favor digite el Pais");
  return;
 }
 if(femp.cargo.value=="")
 {
  alert ("Por favor digite el Cargo");
  return;
 }
 if(femp.fecha_contrato.value=="")
 {
  alert ("Por favor digite la Fecha de Contrato");
  return;
 }
 femp.rep.value=1;
 femp.submit();
}
</script>

<title> EMPLEADOS </title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>

<body leftmargin="50" topmargin="50" marginwidth="50" marginheight="50">


<body bgcolor ="#958623">

<center> <font face ="Arial"> <font size ="7"> <font color ="#34gb74">
  EMPLEADOS </font color> </font size> </font face> 
</center>

<body link="#112233" Vlink="#332211">

<br><br>

<form action="<?php $_SERVER['PHP_SELF']; ?>" name="femp">
<input type="hidden" name="rep" value="1">
<center> 
<table width="200" border="5">
  <tr>
    <td>IDENTIFICACION DEL EMPLEADO </td>
    <td><input name="identificacion" type="text"></td>
  </tr>
  <tr>
    <td>NOMBRES</td>
    <td><input name="nombre" type="text"></td>
  </tr>
  <tr>
    <td>APELLIDOS</td>
    <td><input name="apellido" type="text"></td>
  </tr>
  <tr>
    <td>FECHA DE NACIMIENTO</td>
    <td><input name="fecha_nac" type="text"></td>
  </tr>
  <tr>
    <td>DIRECCION</td>
    <td><input name="direccion" type="text"></td>
  </tr>
  <tr>
    <td>TELEFONO</td>
    <td><input name="telefono" type="text"></td>
  </tr>
  <tr>
    <td>CIUDAD</td>
    <td><input name="ciudad" type="text"></td>
  </tr>
  <tr>
    <td>REGION</td>
    <td><input name="region" type="text"></td>
  </tr>
  <tr>
    <td>PAIS</td>
    <td><input name="pais" type="text"></td>
  </tr>
  <tr>
    <td>CARGO</td>
    <td><input name="cargo"></td>
  </tr>
  <tr>
    <td>FECHA CONTRATO</td>
    <td><input name="fecha_contrato" type="text"></td>
  </tr>
</table>
<font face ="Arial"><font size ="7"><font color ="#34gb74">
<input name="btnagregar" type="button" id="btnagregar" value="GUARDAR" onclick=verifica()>
</font color></font size></font face>
</center>
</form>
</body>

</html>

Última edición por GatorV; 11/09/2008 a las 12:43 Razón: tags php