Hola amigos, estoy implementando un formulario que envía los datos a a una base mysql, para ello use este ejercicio:
http://www.forosdelweb.com/f18/insertar-campos-formulario-base-datos-252189/
Aparentemente todo esta bien, pero cuando consulto la base de datos los registros introducido no aparecen, esto es lo que arroja:
Base de datos maxo_feria
Estructura de tabla para la tabla nombre
Campo
Tipo
Nulo
Predeterminado
Comentarios
id
int(10)
No
Nombre
varchar(50)
No
Apellido
varchar(50)
No
No.deBoleta
varchar(50)
No
FechaInscripcion
varchar(50)
No
Mail
varchar(50)
No
Telefono
varchar(50)
No
Volcar la base de datos para la tabla nombre
id
Nombre
Apellido
No.deBoleta
FechaInscripcion
Mail
Telefono
El código lo introduje de esta forma:
feria.php
<?php
$d_host = "localhost"; // MySQL server host
$d_port = ""; // MySQL server port
$d_user = "maxo_venta"; // MySQL username
$d_pass = "refugio"; // MySQL password
$db_name = "maxo_feria";
//La conexión
$coneccion = mysql_connect($d_host,$d_user,$d_pass) or die ('No se puede conectar con la DB por que: ' . mysql_error());
mysql_select_db($db_name,$coneccion);
# se recogen los datos del formulario
$Nombre = $_POST['Nombre'];
$Apellido = $_POST['Apellido'];
$DNI = $_POST['No.deBoleta'];
$Fechadenacimiento = $_POST['FechaInscripcion'];
$Mail = $_POST['Mail'];
$Telefono = $_POST['Telefono'];
//Insertando en la base de datos
$sql="INSERT INTO $db_name (Nombre,Apellido,No.deBoleta,FechaInscripcion,Mail ,Telefono) VALUES ('.$Nombre.', '.$Apellido.','.$No.deBoleta.','.$Fechadenacimient o.','.$Mail.','.$Telefono.')";
mysql_query($sql,$coneccion);
mysql_close($coneccion);
?>
feria.html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Feria</title>
</head>
<body>
<table width="300" border="0" align="center">
<tr>
<td><div align="center">
<center>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="330" height="152" id="AutoNumber1">
<form action="feria.php" method="post">
<tr>
<td width="324" height="2" colspan="2"></td>
</tr>
<tr>
<td width="121" height="27">Nonbre:</td>
<td width="203" height="27"><input type="text" name="Nombre" size="20" /></td>
</tr>
<tr>
<td width="121" height="20">Apellido:</td>
<td width="203" height="20"><input type="text" name="Apellido" size="20" /></td>
</tr>
<tr>
<td width="121" height="24">No. de Boleta</td>
<td width="203" height="24"><input type="text" name="DNI" size="20" /></td>
</tr>
<tr>
<td width="121" height="17">Fecha Inscripcion:</td>
<td width="203" height="17">
<input type="text" name="Fechadenacimiento" size="20" /></td>
</tr>
<tr>
<td width="121" height="17">Mail:</td>
<td width="203" height="17"><input type="text" name="Mail" size="20" /></td>
</tr>
<tr>
<td width="121" height="21">Telefono:</td>
<td width="203" height="21"><input type="text" name="Telefono" size="20" /></td>
</tr>
<tr>
<td width="324" height="4" colspan="2">
<input type="submit" value="Enviar" name="B1" /><input type="reset" value="Restablecer" name="B2" /></td>
</tr>
</form>
</table>
</center>
</div> </td>
</tr>
</table>
</body>
</html>
Gracias por su ayuda.