Ver Mensaje Individual
  #7 (permalink)  
Antiguo 09/05/2006, 08:35
Avatar de v_i_n_i_c_i_o
v_i_n_i_c_i_o
 
Fecha de Ingreso: noviembre-2003
Ubicación: Costa Rica
Mensajes: 422
Antigüedad: 20 años, 5 meses
Puntos: 0
La cosa está así:


insempleado.php
Cita:
<form name="form1" method="post" action="agregaempleado.php">
<tr>
<td>
<p>C&eacute;dula:
<input type="text" name="txtcedula" maxlength="10">
ej. 101110111</p>
<p>Nombre:
<input type="text" name="txtnombre" maxlength="50" size="50">
</p>
<p>Tel&eacute;fono de residencia:
<input type="text" name="txttelefono" maxlength="7">
</p>
<p>Tel&eacute;fono celular:
<input type="text" name="txtcelular" maxlength="7">
</p>
<p>Direcci&oacute;n:
<input type="text" name="txtdireccion" maxlength="100" size="50">
</p>
<p>Fecha de ingreso:
<input type="text" name="txtingreso">
</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

</td>
</tr>
</form>
<?php
while($row = mysql_fetch_array($result)) {
printf("<tr><td>&nbsp;%s</td><td>&nbsp;%s&nbsp;</td><td>&nbsp
;%s&nbsp;</td><td>&nbsp;%s&nbsp;</td><td>&nbsp;<img
src=%s>&nbsp;</td></tr>",
$row["nombre"],$row["direccion"],$row["telefono"],$row["email
"],$row["imagen"]);
}
mysql_free_result($result);
?>
<?php
include("conec.php");
$link=Conectarse();
$result=mysql_query("select * from empleado",$link);
?>

conec.php
Cita:
<html>
<head>
<title>conexi&oacute;n</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<?php
function Conectarse()
{
if
(!($link=mysql_connect("localhost","root","")))
{
echo "Error conectando a la base de datos.";
exit();
}
if (!mysql_select_db("TELEISA",$link))
{
echo "Error seleccionando la base de datos.";
exit();
}
return $link;
}
Conectarse();

?>
</body>
</html>
agregaempleado.php
Cita:
<html>
<head>
<title>almacenando</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php
$txtcedula=$_POST["txtcedula"];
$txtnombre=$_POST["txtnombre"];
$txttelefono=$_POST["txttelefono"];
$txtcelular=$_POST["txtcelular"];
$txtdireccion=$_POST["txtdireccion"];
$txtingreso=$_POST["txtingreso"];
include("conec.php");
$link=Conectarse();
$Sql="insert into empleado
(cedula,nombre,telefono1,telefono2,direccion,date_ in) values
('$txtcedula','$txtnombre', '$txttelefono', '$txtcelular', '$txtdireccion', '$txtingreso')";
mysql_query($Sql,$link);
header("Location: insempleado.php");
?>

</body>
</html>
__________________
"Un experto es una persona que ha cometido todos los errores que se pueden cometer en un determinado campo" - Niels Bohr
:cool: 0!)!u!/\ :patada: