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

Gracias por los nuevos conocimientos aportados, pero aun me sigue sin funcionar, no se cual sea el error, aqui dejo otro formulario que estoy trabajando y que aplique sus consejos y no me funciona. Una duda nueva es ¿Importa que este trabajando mi propia maquina como el servidor de phpmyadmin? ¿El usuario que coloco en la consulta para la conexion a la Bd cual debe ser, el usuario de phpmyadmin?

Este es el otro formulario:
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=$HTTP_GET_VARS["rep"];

if (
rep==1)
{
 
$identificacion=$HTTP_GET_VARS["identificacion"];
 
$nombre=$HTTP_GET_VARS["nombre"];
 
$apellido=$HTTP_GET_VARS["apellido"];
 
$fecha_nac=$HTTP_GET_VARS["fecha_nac"];
 
$direccion=$HTTP_GET_VARS["direccion"];
 
$telefono=$HTTP_GET_VARS["telefono"];
 
$ciudad=$HTTP_GET_VARS["ciudad"];
 
$region=$HTTP_GET_VARS["region"];
 
$pais=$HTTP_GET_VARS["pais"];
 
$cargo=$HTTP_GET_VARS["cargo"];
 
$fecha_contrato=$HTTP_GET_VARS["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