Ver Mensaje Individual
  #4 (permalink)  
Antiguo 11/09/2008, 14:23
mrdy7
 
Fecha de Ingreso: agosto-2008
Mensajes: 64
Antigüedad: 16 años, 7 meses
Puntos: 0
Respuesta: Cargar un campo en un select

Gracias por la ayuda, este es el script completo, pero no me funciona.

<?php

$ip='localhost';
$usuario='mrdy7';
$contraseña='mi860810';
$bd_nombre='envios';

$con=mysql_pconnect($ip,$usuario,$contraseña) or die ("No se puede realizar la conexion a la Base de Datos");
$err=mysql_select_db($bd_nombre,$con);

if (!empty($_POST['btnagregar']))
{
$query="INSERT INTO `empleados` (id_empleado,nombre_emp,apellido_emp,fecha_naci,di reccion_emp,telefono_emp,ciudad_emp,region_emp,pai s_emp,cargo_emp,fecha_contra) values ('{$_POST['identificacion']}','{$_POST['nombre']}','{$_POST['apellido']}','{$_POST['fecha_nac']}','{$_POST['direccion']}','{$_POST['telefono']}','{$_POST['ciudad']}','{$_POST['region']}','{$_POST['pais']}','{$_POST['cargo']}','{$_POST['fecha_contrato']}')";
$res=mysql_query($query,$con) or die(mysql_error());
}

$cons="SELECT * FROM empleados";
$result=mysql_query($cons) or die(mysql_error());
echo '<select name="id_empleado">';
while ($fila=mysql_fetch_assoc($result))
{
echo '<option value='".$fila['id_empleado']."'>'.$fila['nombre_emp'].'</option>;
}
echo </select>;
?>

<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.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="empleados.php" name="femp" method="post">
<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">
<button name="btnagregar" type="submit" value="1" onclick=verifica()>GUARDAR</button>
</font color></font size></font face>
</center>
</form>
</body>

</html>

me sale el siguiente error

Parse error: syntax error, unexpected '"', expecting ',' or ';' in C:\wamp\www\Empleados.php on line 22