Hello My Friends:
I am learning PHP and MySql using some tutorials and manuals that i've found in internet. I am using Ubuntu 7.04 and I've already installed Apache2, PHP5, MySQL5.0 and everything is working fine. I 've created a small database with PHPMyAdmin called `ficha_laboral` and one table called `datos_personales` with 6 fields.
Ok, everything looks fine until here, but when i try to insert some data in the database through the web browser (firefox), MySql doesn't insert anything in the database. i am using two scripts to do this, the first script is the form where i write all the data, and the second script inserts that data in the database.
This is the form code i'm using:
[HTML]
<html>
<body>
<form method="post" action="http://127.0.0.1/cursophp/add_reg.php">
Nombre :<input type="Text" name="nombre"><br>
Apellido :<input type="Text" name="apellido"><br>
C.I. :<input type="Text" name="ci"><br>
Profesion :<input type="Text" name="profesion"><br>
Fecha de Nacimiento :<input type="Text" name="nacimiento"><br>
Estado Civil :<input type="Text" name="estado"><br>
<input type="Submit" name="enviar" value="Aceptar información">
</form>
</body>
</html>
[/HTML]
and this is the PHP Script i am using (it's name is add_reg.php)
PHP Code:
<?php
// process form
$link = mysql_connect("127.0.0.1", "root","1234");
mysql_select_db("ficha_laboral",$link);
$sql = "INSERT INTO `datos_personales` (`Nombre`,`Apellido`,`CI`,`Profesion`,`Fecha_Nacimiento`,`Edo_Civil`) VALUES ('$nombre', '$apellido', '$ci', '$profesion','$nacimiento','$estado');";
$result = mysql_query($sql);
echo "ˇGracias! Hemos recibido sus datos.\n";
?>
when i execute the script I don't get any error, and everything looks fine, but the database keeps blank.
I've been the whole day trying to find out what is wrong in this code. Can you please help me out???
Thank you very much...