Alguien podría ayudarme con este script para guardar la Cedula en la base de datos?
Publicado por XXX (7 intervenciones) el 05/11/2006 00:24:16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<html>
<body>
<?php
if (isset($_POST["enviar"]))
{
$link = mysql_connect("localhost", "root","123");
mysql_select_db("america2",$link);
$res = mysql_query("SELECT cedula, nombres, apellidos FROM datos_personales WHERE cedula == ($cedula)");
$res = mysql_query($sql);
if ($res = true) then
{
printf (Ya existe alguien con este numero de cedula.\n);
}
else
{
$sql = "INSERT INTO datos_personales (cedula, nombres, apellidos) VALUES ('".$_POST["cedula"]."','".$_POST["nombres"]."', '".$_POST["apellidos"]."')";
$result = mysql_query($sql);
echo "¡Gracias! Hemos recibido sus datos.\n";
die(mysql_error($link));
}
}
else
{
?>
<form method="post" action="prueba4ingreso.php">
Cedula:<input type="Integer" name="cedula"><br>
Nombres:<input type="Text" name="nombres"><br>
Apellidos:<input type="Text" name="apellidos"><br>
<input type="Submit" name="enviar" value="Aceptar información">
</form>
<?php
}
?>
</body>
</html>
Valora esta pregunta


0