Código PHP:
<?php
// Comienza a añadir
$Host = "localhost";
$User = "miuser";
$Password = "mipass";
$DBName = "miBBDD";
$TableName = "miTablaDeLaBBDD";
$Link = mysql_connect($Host, $User, $Password) or die("No se ha conectado al servidor!");
$Resp = mysql_select_db($DBName, $Link) or die("No se ha seleccionado la Base de Datos!");
$dni = $_POST['dni'];
$apell = $_POST['apell'];
$nomb = $_POST['nomb'];
$domic = $_POST['domic'];
$pobl = $_POST['pobl'];
$prov = $_POST['prov'];
$codPos = $_POST['codPos'];
$telef = $_POST['telef'];
$movil = $_POST['movil'];
$email = $_POST['email'];
$titul = $_POST['vTitul'];
$fecTit = $_POST['fecTit'];
$sitLab = $_POST['sitLab'];
$Result=mysql_query("INSERT INTO $TableName (Id, Apellidos, Nombre, DNI, Domicilio, Poblacion, Provincia, Codigo_Postal, Telefono, Movil, EMail, Titulacion, Fecha_Titulo, Situacion_Laboral) VALUES ('', '$apell', '$nomb', '$dni', '$domic', '$pobl', '$telef', '$movil', '$email', '$titul', '$fecTit', '$sitLab')", $Link);
if ($Result)
{
print("<center>");
print("<table style=\"text-align: center\; margin-left: auto\; margin-right: auto\;\" border=\"1\">");
print("<form name='CompExp' action='index.php' method='post'>");
print("<tbody>");
print("<tr style=\"text-decoration: underline\;\">");
print("<td colspan=\"2\" style=\"text-align: center\;\"><center><big><big><b>Egresado añadido con exito!!!</b></big></big></center></td>");
print("</tr>");
print("<tr style=\"text-decoration: underline\;\">");
print("<td style=\"text-align: center\;\"><center><b>DNI : </b></center></td>");
print("<td style=\"text-align: center\;\"><center>$refInt</center></td>");
print("</tr>");
print("<tr style=\"text-decoration: underline\;\">");
print("<td style=\"text-align: center\;\"><center><b>Nombre : </b></center></td>");
print("<td style=\"text-align: center\;\"><center>$nomb</center></td>");
print("</tr>");
print("<tr style=\"text-decoration: underline\;\">");
print("<td style=\"text-align: center\;\"><center><b>Apellidos : </b></center></td>");
print("<td style=\"text-align: center\;\"><center>$apell</center></td>");
print("</tr>");
print("<tr style=\"text-decoration: underline\;\">");
print("<td style=\"text-align: center\;\"><center><b>Domicilio : </b></center></td>");
print("<td style=\"text-align: center\;\"><center>$domic</center></td>");
print("</tr>");
print("<tr style=\"text-decoration: underline\;\">");
print("<td style=\"text-align: center\;\"><center><b>Poblacion : </b></center></td>");
print("<td style=\"text-align: center\;\"><center>$pobl</center></td>");
print("</tr>");
print("<tr style=\"text-decoration: underline\;\">");
print("<td style=\"text-align: center\;\"><center><b>Provincia : </b></center></td>");
print("<td style=\"text-align: center\;\"><center>$prov</center></td>");
print("</tr>");
print("<tr style=\"text-decoration: underline\;\">");
print("<td style=\"text-align: center\;\"><center><b>Codigo Postal : </b></center></td>");
print("<td style=\"text-align: center\;\"><center>$codPos</center></td>");
print("</tr>");
print("<tr style=\"text-decoration: underline\;\">");
print("<td style=\"text-align: center\;\"><center><b>Telefono : </b></center></td>");
print("<td style=\"text-align: center\;\"><center>$telef</center></td>");
print("</tr>");
print("<tr style=\"text-decoration: underline\;\">");
print("<td style=\"text-align: center\;\"><center><b>Movil : </b></center></td>");
print("<td style=\"text-align: center\;\"><center>$movil</center></td>");
print("</tr>");
print("<tr style=\"text-decoration: underline\;\">");
print("<td style=\"text-align: center\;\"><center><b>E-mail : </b></center></td>");
print("<td style=\"text-align: center\;\"><center>$email</center></td>");
print("</tr>");
print("<tr style=\"text-decoration: underline\;\">");
print("<td style=\"text-align: center\;\"><center><b>Titulacion : </b></center></td>");
print("<td style=\"text-align: center\;\"><center>$titul</center></td>");
print("</tr>");
print("<tr style=\"text-decoration: underline\;\">");
print("<td style=\"text-align: center\;\"><center><b>Fecha del Titulo : </b></center></td>");
print("<td style=\"text-align: center\;\"><center>$fecTit</center></td>");
print("</tr>");
print("<tr style=\"text-decoration: underline\;\">");
print("<td style=\"text-align: center\;\"><center><b>Situacion Laboral : </b></center></td>");
print("<td style=\"text-align: center\;\"><center>$sitLab</center></td>");
print("</tr>");
print("<tr>");
print("<td colspan=\"2\" align=center><input type='SUBMIT' class='btn' value='Regresar al Inicio'></td>");
print("</tr>");
print("</form>");
print("</tbody>");
print("</table>");
}
else
{
echo "<p>¡No se ha podido insertar en la BBDD!!!</p>\n";
exit;
}
mysql_close($Link);
?>